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.<div>
<br></div><div>If I understood things correctly, the idea is the following:</div><div><br></div><div>- 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.</div>
<div><br></div><div>- 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 anyway.</div>
<div><br></div><div>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.</div>
<div><br></div><div>Feedback is welcome,</div><div><br></div><div>Juanjo<br><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>
</div></div>