meta-comment on typing Per Bothner (05 Oct 2005 17:35 UTC)
Re: meta-comment on typing John.Cowan (05 Oct 2005 22:00 UTC)
Re: meta-comment on typing Per Bothner (05 Oct 2005 22:14 UTC)
Re: meta-comment on typing John.Cowan (06 Oct 2005 04:55 UTC)
Re: meta-comment on typing Michael Sperber (06 Oct 2005 06:03 UTC)
Re: meta-comment on typing Per Bothner (06 Oct 2005 15:35 UTC)
[SRFI 77] integer-length and integer-sqrt Jens Axel Søgaard (06 Oct 2005 15:54 UTC)
Re: meta-comment on typing Michael Sperber (06 Oct 2005 16:17 UTC)

Re: meta-comment on typing Per Bothner 05 Oct 2005 22:13 UTC

John.Cowan wrote:
> Per Bothner scripsit:
>
>
>>It's a choice bwteeen:
>>(define (square-sum (x :: <flonum>) (y :: <flonum>))
>>  (+ (* x x) (* y y)))
>>or:
>>(define (square-sum x y)
>>  (fl+ (fl* x x) (fl* y)))
>>If you have type specifiers, you don't need the separate operation
>>names.  And type specifiers are much to be preferred.  After all
>>if Scheme is a teaching language, we want to encourage our students
>>to use type declarations, I think.
>
>
> Unless you want to add overloading to Scheme, you have just pushed off the
> problem from the predefined names to the user-defined names, as the above
> will need to be complemented by a version of square-sum that does fixnums.

Huh?  You're comparing apples and oranges.  The srfi-77 version:
(define (square-sum x y)
   (fl+ (fl* x x) (fl* y)))
doesn't do fixnums either.  Perhaps I misunderstand your point.

Yes, another advantage of type declarations is that one *can* (somewhat
more readily) add overloading (as Kawa and some other Scheme dialects
do).  But that's not what I'm arguing for.

My argument is that:
* Adding optional type declarations to Scheme is desirable for a number
of reasons, not just performance - or overloading.
* Once one has optional type declarations, the need for type-specific
arithmetic primitives is reduced or eliminated.
* As a matter of style, I believe type declarations are preferable to
type-specific arithmetic primitives, especially since Type Declarations
are Good in themselves.
--
	--Per Bothner
xxxxxx@bothner.com   http://per.bothner.com/