[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: meta-comment on typing

This page is part of the web mail archives of SRFI 77 from before July 7th, 2015. The new archives for SRFI 77 contain all messages, not just those from before July 7th, 2015.



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.

-- 
You're a brave man! Go and break through the            John Cowan
lines, and remember while you're out there              jcowan@xxxxxxxxxxxxxxxxx
risking life and limb through shot and shell,           www.ccil.org/~cowan
we'll be in here thinking what a sucker you are!        www.reutershealth.com
        --Rufus T. Firefly