[pro] Default safety level and specialized arrays

Svante v. Erichsen Svante.v.Erichsen at web.de
Wed Mar 11 20:25:22 UTC 2015


On 2015-03-10 21:15:31+0100, Pascal J. Bourguignon wrote:
> 
> > On 10 Mar 2015, at 17:02, Edi Weitz <edi at weitz.de> wrote:
> > 
> > After rummaging around in the HyperSpec and various implementation
> > manuals I came to the following conclusion:
> > 
> > 1. The standard doesn't prescribe such thing as a default safety level
> > for CL implementations and there's no portable way to figure out the
> > safety level of the global environment.  (And the same holds for other
> > optimize qualities.)  The closest I could find in the CLHS is 3.3.1
> > where they talk about an "implementation that always processes code as
> > if safety were high."  From this I conclude that implementations are
> > allowed NOT to do this or otherwise there would be no need to mention
> > it.
> > 
> > The LispWorks manual for example describes the defaults in section 9.5
> > about compiler control, but for SBCL I couldn't find them in the
> > manual.
> > 
> > 2. The standard doesn't prescribe what should happen if you try to
> > write an element of a wrong type to a specialized array, even in safe
> > code.
> > 
> > Both LispWorks and SBCL will by default complain in this case but my
> > understanding is that you can't rely on this in portable code.
> > 
> > So, my question is whether the above is correct or if I missed something?
> 
> Yes. 
> 
> Notably, with (safety 0), Common Lisp implementation could be as good as common C implementations...
> 
> This is why it is very bad to put optimization declarations in libraries (well, if they're not (safety 3) (speed 0)): 
> it HAS and WILL make users lose days in debugging because YOUR, Edi, libraries, compiled on conforming
> implementations fail to detect errors.

Hello!

This begs the question: how do I get a speed optimized library then?  Do I need
to make a local fork just to insert declarations?  Is there a way to tell
e. g. ASDF to use certain declamations?  Is making the declarations in the
library dependent on documented entries to *features* the way to go?  Where
would I push the desired settings into *features*?

Yours aye

Svante


-- 
Svante von Erichsen

GPG fingerprint: A78A D4FB 762F A922 A495  57E8 2649 9081 6E61 20DE
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <https://mailman.common-lisp.net/pipermail/pro/attachments/20150311/5801d572/attachment.sig>


More information about the pro mailing list