[Ecls-list] Checked type declarations as in SBCL?

Juan Jose Garcia-Ripoll juanjose.garciaripoll at googlemail.com
Mon Dec 26 22:53:18 UTC 2011

I have been struggling for the past weeks trying to find out what would be
the most useful way to interpret type declarations in ECL... without much
success. It is for this reason that I have finally decided to follow other
people's practices and import SBCL's policy on type declarations.

If I understood things correctly, the idea is the following:

- SBCL tries to infer the type of all expressions (ECL too). In particular,
the type of a variable is also inferred based on the assignments and the
code flow.

- A type declaration for a variable is considered an annotation such that
every assignment to that variable is checked to have at least that type --
note that the compiler might have inferred a different, more specific type

I am experimenting with this model right now. It is useful in the sense
that at low optimization settings things remain the same, while at high
settings some additional type checking is performed -- and in ECL's case it
led to the discovery of some incorrect type declarations at execution time.
It also has the advantage that type declarations can then be blindly
trusted even at high safety settings, due to the checks which are emitted
by the compiler.

Feedback is welcome,


Instituto de Física Fundamental, CSIC
c/ Serrano, 113b, Madrid 28006 (Spain)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.common-lisp.net/pipermail/ecl-devel/attachments/20111226/f39224ba/attachment.html>

More information about the ecl-devel mailing list