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: Marcin Borkowski
Subject: Re: Which Elisp types are mutable?
Date: Sat, 05 Jun 2021 13:22:42 +0200
User-agent: mu4e 1.1.0; emacs 28.0.50

On 2021-06-03, at 14:11, Philipp <p.stephani2@gmail.com> wrote:

>> Am 03.06.2021 um 06:03 schrieb Marcin Borkowski <mbork@mbork.pl>:
>> 
>> Well, the subject says it all.  I could find an explicit, comprehensive
>> list of mutable (or immutable) types in the Elisp manual.  Is it there
>> somewhere?
>
> Mutability is a property of objects, not types.
> Some objects (numbers) are always immutable, others (markers, buffers, ...) 
> are always mutable.  But objects of most "interesting" types (strings, lists, 
> vectors, symbols) can be either mutable or immutable.
> Some time ago, I filed https://debbugs.gnu.org/cgi/bugreport.cgi?bug=43557 to 
> document which objects are mutable, but unfortunately it's not yet fixed.

Thanks.  However, I still don't understand.  How can a list be
immutable?  What about a string?  I thought these are _always_ mutable
(although in some cases you must not mutate them, because if you do, bad
things could happen - see e.g. my blog post here:
http://mbork.pl/2016-05-23_Literal_values_and_destructive_functions).

Also, I thought symbols are immutable.  Can you provide an example
showing that they aren't?

TIA,

-- 
Marcin Borkowski
http://mbork.pl



reply via email to

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