Re: Common Lisp solved this problem 20 years ago
bear 27 Oct 2005 06:02 UTC
On Wed, 26 Oct 2005, Thomas Bushnell BSG wrote:
>But then compiling in unsafe mode now changes the behavior of the
>program, even correctly behaving programs, because if it turns off the
>coercion, the semantics of the program change, right?
Yeah. This is behavior that I object to, too. A type specifier
should never affect the semantics of correct code.
If you want modular operations, those are *NOT* just a type variation
on the standard operations. Those introduce semantics the standard
operations don't have, in cases that would not be errors for the
standard operations.
And, to me, that is NOT the job of type declarations. Not in a Lisp
anyway. That is the job of function definition. I like the "type
declaration as assertion" method, where type declarations that happen
to be true never ever change the meaning of correct code.
Bear