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

Issue: CONSTANT-SIDE-EFFECTS (no proposal)

re: While it is certainly possible to address the issue by making "constant" a
    first-class run-time accessable property of data, I don't think we are
    going to make a lot of progress if we choose that direction.

Well, I mentioned this avenue -- elevating to first class the hidden concept
of "read-only", or whatever it is that is different about "constants" --
because it was one of the more sensible criticisms that came out of six
months of haggling.  "Haggling" first on the common-lisp@sail mailing list,
and verbally at the Scheme community meetings at Snowbird in mid July.

I would very much like to know what implementations do something akin to 
the PDP10 MacLisp treatment of "constants", or maybe an extension thereto:
  (1) except possibly for symbols, they are stored in a separate storage 
      area, which will be made write-protected at the next "disksave";
  (2) they ("constants") are identified by the compiler as the result of 
      any evaluable program like (QUOTE <anything>).  [Note that certain
      datatypes other than lists and symbols may be "implicitly quoted".]
I think that Symbolics and Lucid do this, and suspect TI of doing it too;
but what of the many others?  

Lucid also treats many "compiled-functions" as constants (i.e. "read-only"),
namely those loaded in from a file produced by compile-file; in effect, 
(FUNCTION (LAMBDA ...)) is recognized as a "constant" too [note that this 
isn't related to the discussion about a constant-function declaration, which
was primarily about what kinds of "functions" would ever be assigned to the
declared name].  For purposes of this discussion, (DEFUN FOO ...) is handled 
as if it were just (SETF (SYMBOL-FUNCTION 'FOO) (FUNCTION (LAMBDA ...))).

Additionally, before investing any time in such a proposal, I wonder how 
controversial it would be to insist (or, maybe just "suggest") that the 
interpreter evaluate (QUOTE <anything>) not merely into <anything>, but 
rather into a possibly-cached copy of <anything> that is known to be 
CONSTANT-STORAGE-P.  That is, the interpreter must do something very similar
to what the compiler does for constants.  Without this clause -- without
rectifying the Lisp 1.5 mistake that defines QUOTE like CAR -- there is
far too much potential for interpreted/compiled mismatch.  I really 
wouldn't want to address "constants" if it applied _only_ to the output
of the compiler.

Garbage-collection of "constants" is a separate issue that I think 
needn't be addressed by our emerging (non) proposal.

-- JonL --