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: Philipp
Subject: Re: Which Elisp types are mutable?
Date: Mon, 5 Jul 2021 20:41:58 +0200


> Am 05.06.2021 um 21:19 schrieb Marcin Borkowski <mbork@mbork.pl>:
> 
> 
> On 2021-06-05, at 14:58, Philipp <p.stephani2@gmail.com> wrote:
> 
>>> Am 05.06.2021 um 13:22 schrieb Marcin Borkowski <mbork@mbork.pl>:
>>> 
>>> 
>>> 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
>> 
>> "You must not mutate them" is the definition of immutable.
> 
> Well, in my book, "you can't mutate them" is.  You always /can/ mutate
> a string, but of you do it in certain circumstances, you're asking for
> trouble.

You can mutate all objects, because all of them are stored in mutable memory.
For a reference manual, "you're asking for trouble" isn't a terribly useful 
statement.


reply via email to

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