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

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

Re: Which Elisp types are mutable?


From: tomas
Subject: Re: Which Elisp types are mutable?
Date: Mon, 5 Jul 2021 20:55:03 +0200
User-agent: Mutt/1.5.21 (2010-09-15)

On Mon, Jul 05, 2021 at 09:48:51PM +0300, Eli Zaretskii wrote:
> > From: Philipp <p.stephani2@gmail.com>
> > Date: Mon, 5 Jul 2021 20:41:58 +0200
> > Cc: Help Gnu Emacs mailing list <help-gnu-emacs@gnu.org>

[...]

> > You can mutate all objects, because all of them are stored in mutable 
> > memory.
> 
> Not if you put it in read-only memory: you'd get a segfault with any
> modern OS.
> 
> > For a reference manual, "you're asking for trouble" isn't a terribly useful 
> > statement.
> 
> And "you must not mutate them" is?  At least "you're asking for
> trouble" explains why not, especially if it actually describes some of
> the trouble.

I think putting things into absolute terms is what creates trouble here.
Mutable makes sense wit respect to a language model. In Python, for
example, strings are immutable because the language model doesn't provide
mutating operations. If you write a C library to poke holes in a Python
string, you are extending the language model and thus moving the
goalposts. Your game, have fun :-)

In Emacs Lisp, typical immutable objects are symbols, keywords, numbers
(although bignums technically could be made mutable, I don't think it'd
make much sense :)

Perhaps there are some I missed.

Cheers
 - t

Attachment: signature.asc
Description: Digital signature


reply via email to

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