Subject: Re: modify quoted list (was Re: weird function behavior)
From: Erik Naggum <erik@naggum.net>
Date: Fri, 07 Jun 2002 23:29:26 GMT
Newsgroups: comp.lang.lisp
Message-ID: <3232481348218721@naggum.net>

* Thomas F. Burdick
| In my mental model of the Lisp world, anything returned by QUOTE is in
| read-only space.  So for example, in '(1 2 (a (foo . bar) c) 4 5), all
| nine of those cons cells are read-only.  The compiler I'm working on
| expresses this literally; it goes to some lengths to make sure that all
| literal data is in read-only memory, so you'll get an error if you try to
| modify it.  It would be really nice if the major lisp compilers did this.

  Are all self-quoting objects that are created by the reader turned into
  read-only objects or do you make a special case for quote?  The typical
  example is the literal string.  The above could easily be read to imply
  that only the special operator quote produces literals, which you may not
  have meant.  I see a definite problem with identifying, remembering, and
  maintaining the creation time of objects.  Unless you _only_ arrange for
  the loader to create read-only objects out of the literals that survive
  compilation, I see a truckload of problems here.  E.g., the reader may
  well cause portions of an evaluated back-quoted form to share structure
  with the original list.  Incidentally, if you treat all pathnames as
  read-only objects (since there are no mutators for them), you could also
  intern them and save on translation to namestrings.
-- 
  In a fight against something, the fight has value, victory has none.
  In a fight for something, the fight is a loss, victory merely relief.

  70 percent of American adults do not understand the scientific process.