bug-gnu-emacs
[Top][All Lists]
Advanced

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

bug#40671: [DOC] modify literal objects


From: Drew Adams
Subject: bug#40671: [DOC] modify literal objects
Date: Thu, 30 Apr 2020 22:15:53 -0700 (PDT)

> >> You're _not_  using the language that's used for Common Lisp.
> > In what sense does the language differ? Here's a quote from CLtL2
> (page 115):
> >
> > "it is an error to destructively modify any object that appears as a
> constant
> > in executable code, whether within a 'quote' special form or as
> > a self-evaluating form."
> 
> As Drew pointed out (and if I understood this correctly), the above
> specification leads to implementations that do raise an error when
> someone tried to modify such a value.

That's my understanding.  I believe that wasn't
the case for CLTL(1) - there was no such promise
or requirement.  And I think it's also not the
case for Elisp.  Like CLTL(1), we should just
warn users about the gotcha, since there's no
protection from it.

To be clear, I'm no expert on CLTL2.  I used
CL for years before that.  The gotcha bit me
once, having modified the result of a quoted
list - and then someone explained what was
happening.

It's too easy for a newbie to think only in
terms of textual source code being interpreted.
It's easy not to realize, as Michael said, that
there's the Lisp reader, the interpreter, and
the byte-compiler, and each might get a chance
to handle a quoted list.  And just how they did
so was not specified.

Presumably, a conformant CL implementation now
protects you from this gotcha.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]