[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Two functions for everything?



I was under the impression that we were discussing a proposal to standardize
what kinds of error checking certain functions (like CAR and AREF and SUBSEQ)
should perform when called from code compiled with various settings of the
"optimize safety" switch.  The main reason why I would like to have a
standard, high-level utility to do such things is so that ordinary users
would have a portable way to provide various levels of error checking for
functions they write themselves.  Secondarily, it's a lot of work for us
implementors to have to write 4 different versions of each of these
functions (or hand-code them with 4 entry points) and manually add special
hooks so the compiler will know about them.  I think a more general utility
would be less work in the long run.  Furthermore, I think that there's a
much better chance that various implementors could agree to do the same
kinds of error checks if it were easy to do so, instead of requiring a lot
of special-purpose hackery.

Conditional compilation of in-line error checks based on the current value
of the safety setting is another matter entirely.  Again, the language
doesn't provide any portable way to do this, but it doesn't really sound
like such an unreasonable thing for a user to want to do.

Parenthetically, I might point out that this is similar to the problems
involved with implementing generic arithmetic and sequence functions.  CL
puts so much emphasis on polymorphic functions it's somewhat annoying that
there aren't built-in utilities for ordinary users to use to define their
own polymorphic functions and make them known to the compiler in a portable
way.  It would be real nice to have a way to generate dispatching code
automatically, and optionally hook into the compiler so it can make use of
declarations to do generic-to-specific optimizations.  It's especially
annoying because probably most implementations already have some internal
mechanisms to do this (and those that don't would benefit from having
them, if experience with PSL/PCLS is anything to go by).  And, I don't
think there's anything inherently nonportable about such a utility.

-Sandra
-------