Re: Common Lisp solved this problem 20 years ago
Per Bothner 26 Oct 2005 06:51 UTC
Alan Watson wrote:
> I have realized (remembered?) that type specifiers are only one of the
> ingredients in this particular recipe for solving this problem.
>
> For example, consider the following in Kawa's notation:
>
> (lambda (x :: <flonum> y :: <flonum>) :: <flonum>
> (/ x y))
>
> Unless the compiler can be sure that / is the standard division
> procedure, there is not much it can do.
>
> Of course, module systems often allow the compiler to figure out what /
> really is, and a module system will come fitted as standard in R6RS.
Common Lisp allows a compiler to *assume* / is defined to the standard
/ operation, unless there is a visible re-definition.
Kawa makes more-or-less the same assumpions.
I think that is a reasonable default mode for a compiler.
Also note I am assuming "compatible run-time typing" and behavior:
http://srfi.schemers.org/srfi-77/mail-archive/msg00009.html
http://srfi.schemers.org/srfi-77/mail-archive/msg00012.html
--
--Per Bothner
xxxxxx@bothner.com http://per.bothner.com/