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

&REST args

In regards to the properties of &REST arguments:  There may be a way to
have our cake and eat it too given that CL has a declaration mechanism
in place already and optimization hints are considered first class citizens.
decls in the Symbolics implementations.  In the function  with the &REST arg,
that arg could be declared DOWNWARD meaning that pointers to it and top-level
CDRS are not stored upward and/or it could be declared NO-SETF meaning that
none of the structure (top-level or otherwise) is modified.  The intention
here is that the function not mdify part of the &REST arg because it is part
of that arg---the function's contract (documentation) could specify that some
other structure might be modified and if part of that structure is shared by
the &REST parameter, then caveat caller as usual.  On the call to apply, the
last argument could be declared to be SMASHABLE and/or SHARABLE when it is
and/or compiler optimizers can detect when the list is freshly consed or a
quote etc.  Apply could decide whether to pass the original, stack cons,
or heap cons as appropriate.  When in doubt, it would always do the latter.