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

smashed constants



    Date: Tue, 14 Jun 88 13:18 EDT
    From: ELIOT@cs.umass.edu

    Still, I think my abstract point holds.  QUOTE is a very good way to
    construct small and simple data structures, but there are many data
    structures that cannot *reasonably* be constructed with it.
    So QUOTE can't support a general mechanism for constructing read
    only data. If Common Lisp is going to have a notion of read-only,
    (for those implementations capable of it) then it would be best to
    support a general mechanism for it.

I think this is also KMP's point, but I can't dig up that message, so:

It should never be the Lisp's responsibility.  If an implementation
wants to support read-only-ness then it should be explicit.
Perhaps one may say (copy-list-into-read-only-space <list>) or
(copy-tree... ).  That removes from the implementation the
responsibility of deciding the level provided (i.e. you can move
whatever you want into read-only space, as you wish.  You could have a
read-only array containing lists which existed in read/write space, for
instance.)

Note that you can then get the quote behavior you want by doing

(defvar +some-internal-list+ (copy-list-into-read-only-space *another-list*))

(defun foo (x) (cons x (quote #,+some-internal-list+)))

I think you are confusing the meaning of QUOTE, which is merely a kind
of SUPPRESS-EVAL.