[Ecls-list] Status of CVS

Juan Jose Garcia-Ripoll jjgarcia at users.sourceforge.net
Tue May 13 12:15:26 UTC 2008

On Tue, May 13, 2008 at 1:04 PM, Gabriel Dos Reis
<gdr at integrable-solutions.net> wrote:
>  So, what is your take on function type proclamation?
>  (OpenAxiom uses it a lot).

It's not my take, but if we are to be consistent with how other lisps
behave, these proclamations can be used at any time, but they will
only buy you something for user functions at safety 0. In this case,
the user is really saying: I will pass you the right data. If he/she
does not , then the outcome of the computation is really undefined, as
the compiled code  might be directly accesing a slot that does not
exist, or doing something like that. If safety > 1, the function will
have a CHECK-TYPE form at the entrance anyway, so it does not matter
whether there was a proclamation or not.

A completely different thing are functions from the Lisp core that can
be inlined depending on the safety settings. ECL has a lot of them.
They can be transformed into different C statements depending on the
type of the arguments. Again, if we are to be consistent with the
previous behavior, the unchecked forms should only be activated at
safety = 0. The forms that work for all types can be inlined always
unless the settings are DEBUG > 1.

Finally we have unboxed functions. Once they are implemented they will
be the only ones that will really profit from type proclamations. The
question is, at what level of safety should we implement those
functions? For consistency, if at safety = 1 we are inserting
check-type forms because we do not believe the types of the arguments,
they should only work at safety = 0.

Note that here I am not expressing the behavior that _I_ would like or
prefer. The previous line of thought is what I conclude from looking
at what kind of code the SBCL compiler is producing at different
safety levels (*) and thereby extracting what other people might
expect. Indeed, when I initiated this thread was to gather information
about your expectations, not to fight about what is right or wrong.

My take is that there should be consistency among different
implementations, while leaving room for everybody: those that really
want type declarations to buy them fast code and those who care more
for code being safe, as well as a point in between.


(*) Why SBCL? Well, CLISP does not have these problems. GCL produces
too unsafe code to even consider mimicking it. CMUCL shares roots with
SBCL. And I do not have commercial lisps to look at -- and would
rather not.

Facultad de Fisicas, Universidad Complutense,
Ciudad Universitaria s/n Madrid 28040 (Spain)

More information about the ecl-devel mailing list