On 10 Mar 2015, at 17:02, Edi Weitz <edi@weitz.de> wrote:

Hi everybody,

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.

-- 
__Pascal J. Bourguignon__