[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
User-Visible Declarations and Proclamations
Date: Mon, 18 May 87 12:04 EDT
Since the code now works on both sequences and lists, it must test
at run-time what kind of argument it has (similiar to the MAP-INTO code).
This could be avoided if the type was declared to be a list or vector.
I would like to solicit discussion on the possibility of providing one
or more functions or variables in Common Lisp to provide information
about any declarations or proclaimations that are in effect.
Previous mail by a number of people has indicated a desire to be able to
determine whether a variable has been proclaimed special (e.g. DEFVAR).
This is another example of the general problem.
For type declarations, something like (DECLARED-RESULT-TYPE Form) --> Type
would allow macro-expanders to possibly generate much more efficient code.
I imagine all systems with a compiler have this kind of a function in one
form or another. A system could always just return T.
What about defining the global variables *speed*, *safety*, and
*compiler-speed* to be bound to their proclaimed values?
Another possibility is to have one general function that takes as arguments
what kind of information is requested.
This sort of thing would probably be useful, although I think it's clear that
it needs to be thought out a lot more carefully before standardizing on anything.
However, I don't think you need it for your particular application. Just expand
into a TYPECASE and rely on the compiler to constant-fold it if the type tests
have known results due to declarations. Perhaps not all compilers do this
optimization, but it's a reasonable optimization to expect.