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

Handling of #, (load-time-eval)

   From: franz!ucbarpa!cs.utah.edu!sandra%cdr (Sandra J Loosemore)

   (3) Throw out #, entirely and do not provide any other similar

But, of course, all implementations would preserve it anyway for
backward compatibility.  This is a wishy-washy choice.

   (4) Simply clarify that #, must appear inside of quoted structure and
   that it's really not the same as #. in interpreted code.

A real problem with #, is that it's mechanism is unavailable *except*
via the reader, but some functions are composed by functions other
than the reader.

   To summarize briefly the responses I got to my question about #,
   usage, it appears that nearly all usages of #, could be replaced by
   references to a variable initialized with DEFVAR or DEFCONSTANT.  The
   people who responded appeared to be well aware of this, but liked #,
   syntax better because they didn't have to think of a variable name,
   and thought it might be somewhat more efficient.

I don't remember whether this was mentioned explicitly, but one
benefit of #, is that it is *clearer* -- the load-time-eval form
appears at its point of use or inclusion, and not at some distant
DEFVAR.  This is not a minor point.

   As far as I can
   tell, #, is almost never used at other than top-level in quoted
   structure (that is, people use '#,(foo) but not '(... #',(foo) ...)).

Allegro's flavor implementation does use the #, mechanism inside
quoted structures.  However, this is also a prime example of a program
that (almost) needs access to the magic internal token, since the
forms being compiled are generated by hairy DEFFLAVOR internal macros
and not read by the reader.

   Finally, a subissue I think we need to touch upon: Should the object
   returned by evaluating the form indicated by #, be read-only?  I'd
   argue that if we go with a proposal that restricts #, to appearing in
   quoted structure, and if we accept that quoted structures are
   read-only, we'd have to say Yes to this question as well.

I think that #, should only appear inside quoted structure.  However,
as an extension, might we also permit the value returned by #, to be
any self-evaluating object?  E.g.:

  (setq foo
     (1+ #,(seventh (decode-universal-time

The value returned by the #, expression is always an integer, which is
always self-evaluating.  The compiler could be allowed to assume that
anything returned by #, will not require further evaluation.