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

Re: Common Lisp solved this problem 20 years ago

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 <per@xxxxxxxxxxx> writes:

> Thomas Bushnell BSG wrote:
>> I thought the primary semantic of a type declaration was that it told
>> the compiler what type the variable would be used to hold.  Now you
>> also are using it for something other than a declaration, viz., a
>> particular operation.
>> Among other things, it slows things down because you have to test the
>> result of the init to see whether coercion is necessary.
> Not necessarily.  Sometimes the compiler can infer that the
> coercion is a no-op or trivial.  

Sure, but in a great many of those cases, the compiler might not need
the declaration anyway. :)

> And sometimes people can compile
> in "unsafe" mode, just as with the Common Lisp model.

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?