[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.

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.  And sometimes people can compile
in "unsafe" mode, just as with the Common Lisp model.

More to the point, I object to the use of a type declaration which
also signifies an operation.  Among other things, you lose one of the
timing benefits of the type declaration.  Why not separate these two?

Maybe you're using "declaration" to mean something wildly different
from the Lisp meaning.

It is somewhat different, yes.  I'm not proposing "type
declarations" in the Common Lisp sense.  I use the word "declaration"
in the more usual "variable declaration" sense.  I'm adding optional
"type specifiers" to "variable declarations".
	--Per Bothner
per@xxxxxxxxxxx   http://per.bothner.com/