<div class="gmail_quote">On Thu, Dec 29, 2011 at 1:33 PM, Nikodemus Siivola <span dir="ltr"><<a href="mailto:nikodemus@random-state.net">nikodemus@random-state.net</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

On 29 December 2011 12:24, Juan Jose Garcia-Ripoll<br>
<div class="im"><<a href="mailto:juanjose.garciaripoll@googlemail.com">juanjose.garciaripoll@googlemail.com</a>> wrote:<br>> - Type declarations are always believed</div><div class="im">
> - SAFETY >= 1 adds type checks to enforce them.<br>
> - SAFETY = 0, no checks.<br>
> - SAFETY = 1, the special form THE or additional proclamations on the<br>
> functions can be used to deactivate the check. As in (LET ((Y (THE FIXNUM<br>
> (FOO X))) ...)<br>
<br>
</div>I somewhat dislike making THE a loophole  [...]<br>
CMUCL has the equivalent as EXT:TRULY-THE. You may want to consider<br>
something like that as well. [...]<br>
At the end, as long as SAFETY 0 = trust everything blindly and SAFETY<br>
3 = check everything, I think you're well within the bounds of custom<br>
and sanity if you choose to make SAFETY 1 a bit magical.</blockquote></div><div><br></div><div>I believe there can be a compromise between safety and speed. There are many macros and user code that can perform assertions about the code that the compiler will never be able to, and it is in my opinion unfortunate that all the safety checks have to be removed to take full advantage of those.</div>

<div><br></div><div>I also understand that some of the type checks are cheap, specially if the compiler is allowed to "simplify" them, as SBCL does for SAFETY=1, but the result is code bloat. Lots of avoidable checks, branching and error messages that we could do without, without actually sacrificing safety. That does not seem like a bad case for something in between both extremes.</div>

<div><br></div><div>Conceptually, in the model above, I do not see the THE as a loophole, but rather as two different things: variable declarations = type checked assignments, value declarations = compiler hints. For instance, if I invoke a function with a THE argument, SBCL will not generate a check: (FOO (THE FIXNUM X)) is just (FOO X), am I wrong? (I just checked in Ubuntu's SBCL) Then in that sense THE does not really make much sense at all, because the type checks are introduced by assignments to variables, not by this special form.</div>

<div><br></div><div>Juanjo</div><div><br></div>-- <br>Instituto de Física Fundamental, CSIC<br>c/ Serrano, 113b, Madrid 28006 (Spain) <br><a href="http://juanjose.garciaripoll.googlepages.com" target="_blank">http://juanjose.garciaripoll.googlepages.com</a><br>