* Which Elisp types are mutable?
@ 2021-06-03 4:03 Marcin Borkowski
2021-06-03 12:11 ` Philipp
0 siblings, 1 reply; 23+ messages in thread
From: Marcin Borkowski @ 2021-06-03 4:03 UTC (permalink / raw)
To: Help Gnu Emacs mailing list
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?
TIA,
--
Marcin Borkowski
http://mbork.pl
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: Which Elisp types are mutable?
2021-06-03 4:03 Which Elisp types are mutable? Marcin Borkowski
@ 2021-06-03 12:11 ` Philipp
2021-06-05 11:22 ` Marcin Borkowski
0 siblings, 1 reply; 23+ messages in thread
From: Philipp @ 2021-06-03 12:11 UTC (permalink / raw)
To: Marcin Borkowski; +Cc: Help Gnu Emacs mailing list
> 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.
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: Which Elisp types are mutable?
2021-06-03 12:11 ` Philipp
@ 2021-06-05 11:22 ` Marcin Borkowski
2021-06-05 12:58 ` Philipp
0 siblings, 1 reply; 23+ messages in thread
From: Marcin Borkowski @ 2021-06-05 11:22 UTC (permalink / raw)
To: Philipp; +Cc: Help Gnu Emacs mailing list
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
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: Which Elisp types are mutable?
2021-06-05 11:22 ` Marcin Borkowski
@ 2021-06-05 12:58 ` Philipp
2021-06-05 14:25 ` Stefan Monnier via Users list for the GNU Emacs text editor
2021-06-05 19:19 ` Marcin Borkowski
0 siblings, 2 replies; 23+ messages in thread
From: Philipp @ 2021-06-05 12:58 UTC (permalink / raw)
To: Marcin Borkowski; +Cc: Help Gnu Emacs mailing list
> 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.
> Also, I thought symbols are immutable. Can you provide an example
> showing that they aren't?
Symbols are probably a weird case terminology-wise. Here I define "mutable symbol" as symbol whose value and function slots can be changed (true for most symbols except keywords). However, arguably other definitions are possible, depending on whether you see their values and function slots as "part of a symbol" or as something they refer to. (The manual doesn't specify this.)
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: Which Elisp types are mutable?
2021-06-05 12:58 ` Philipp
@ 2021-06-05 14:25 ` Stefan Monnier via Users list for the GNU Emacs text editor
2021-07-05 18:40 ` Philipp
2021-06-05 19:19 ` Marcin Borkowski
1 sibling, 1 reply; 23+ messages in thread
From: Stefan Monnier via Users list for the GNU Emacs text editor @ 2021-06-05 14:25 UTC (permalink / raw)
To: help-gnu-emacs
> "You must not mutate them" is the definition of immutable.
Not necessarily: where I come from "immutable" means that the object
cannot and will not be mutated.
Stefan
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: Which Elisp types are mutable?
2021-06-05 12:58 ` Philipp
2021-06-05 14:25 ` Stefan Monnier via Users list for the GNU Emacs text editor
@ 2021-06-05 19:19 ` Marcin Borkowski
2021-06-05 20:17 ` [External] : " Drew Adams
2021-07-05 18:41 ` Philipp
1 sibling, 2 replies; 23+ messages in thread
From: Marcin Borkowski @ 2021-06-05 19:19 UTC (permalink / raw)
To: Philipp; +Cc: Help Gnu Emacs mailing list
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.
>> Also, I thought symbols are immutable. Can you provide an example
>> showing that they aren't?
>
> Symbols are probably a weird case terminology-wise. Here I define "mutable symbol" as symbol whose value and function slots can be changed (true for most symbols except keywords). However, arguably other definitions are possible, depending on whether you see their values and function slots as "part of a symbol" or as something they refer to. (The manual doesn't specify this.)
Ah, I see. For me, a symbol is one thing, and what is in its
function/value/properties cells is another.
Best,
--
Marcin Borkowski
http://mbork.pl
^ permalink raw reply [flat|nested] 23+ messages in thread
* RE: [External] : Re: Which Elisp types are mutable?
2021-06-05 19:19 ` Marcin Borkowski
@ 2021-06-05 20:17 ` Drew Adams
2021-06-05 20:36 ` Dmitry Gutov
2021-07-05 18:41 ` Philipp
1 sibling, 1 reply; 23+ messages in thread
From: Drew Adams @ 2021-06-05 20:17 UTC (permalink / raw)
To: Marcin Borkowski, Philipp; +Cc: Help Gnu Emacs mailing list
> > Symbols are probably a weird case terminology-wise. Here I define "mutable
> symbol" as symbol whose value and function slots can be changed (true for
> most symbols except keywords). However, arguably other definitions are
> possible, depending on whether you see their values and function slots as
> "part of a symbol" or as something they refer to. (The manual doesn't
> specify this.)
>
> Ah, I see. For me, a symbol is one thing, and what is in its
> function/value/properties cells is another.
Do you say the same about a cons cell? Certainly
the container is one thing and what it contains
is another, in one sense. That's true of any kind
of container, from a file to a defstruct.
Mutability of list structure is all about changing
the contents (car, cdr) of cons cells. It has no
other meaning.
Lisp symbols are a kind of object. They have
attributes, including name, value (as a variable),
function definition, and an unlimited slew of
other attributes: their `symbol-properties'.
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: [External] : Re: Which Elisp types are mutable?
2021-06-05 20:17 ` [External] : " Drew Adams
@ 2021-06-05 20:36 ` Dmitry Gutov
2021-06-06 1:57 ` Drew Adams
0 siblings, 1 reply; 23+ messages in thread
From: Dmitry Gutov @ 2021-06-05 20:36 UTC (permalink / raw)
To: Drew Adams, Marcin Borkowski, Philipp; +Cc: Help Gnu Emacs mailing list
On 05.06.2021 23:17, Drew Adams wrote:
> Lisp symbols are a kind of object. They have
> attributes, including name, value (as a variable),
> function definition, and an unlimited slew of
> other attributes: their `symbol-properties'.
A symbol does not contain its properties. They're stored in some alist
externally.
^ permalink raw reply [flat|nested] 23+ messages in thread
* RE: [External] : Re: Which Elisp types are mutable?
2021-06-05 20:36 ` Dmitry Gutov
@ 2021-06-06 1:57 ` Drew Adams
0 siblings, 0 replies; 23+ messages in thread
From: Drew Adams @ 2021-06-06 1:57 UTC (permalink / raw)
To: Dmitry Gutov, Marcin Borkowski, Philipp; +Cc: Help Gnu Emacs mailing list
> > Lisp symbols are a kind of object. They have
> > attributes, including name, value (as a variable),
> > function definition, and an unlimited slew of
> > other attributes: their `symbol-properties'.
>
> A symbol does not contain its properties. They're
> stored in some alist externally.
You're missing the point, it seems. The distinction
is conceptual, not implementation. Contain / have /
point to ... distinctions don't matter here. And
their possible implementations matter even less.
By your criterion a cons cell doesn't contain its
cdr either - or its car. A symbol is a thing that
has properties / attributes, whatever you want to
call them. How it has them / where they're stored
is a completely different matter (and irrelevant here).
"Parts" of both a cons and a symbol are changeable.
They're both mutable, and that's the case using just
Lisp. ("Parts", not "the parts". Not all parts of
a symbol are changeable - e.g., the name isn't.)
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: Which Elisp types are mutable?
2021-06-05 14:25 ` Stefan Monnier via Users list for the GNU Emacs text editor
@ 2021-07-05 18:40 ` Philipp
2021-07-05 20:19 ` Stefan Monnier
0 siblings, 1 reply; 23+ messages in thread
From: Philipp @ 2021-07-05 18:40 UTC (permalink / raw)
To: Stefan Monnier; +Cc: help-gnu-emacs
> Am 05.06.2021 um 16:25 schrieb Stefan Monnier via Users list for the GNU Emacs text editor <help-gnu-emacs@gnu.org>:
>
>> "You must not mutate them" is the definition of immutable.
>
> Not necessarily: where I come from "immutable" means that the object
> cannot and will not be mutated.
>
Then there are no immutable objects, because all objects are stored in mutable memory. It's just that mutating some of them is a bit harder than others. So this definition of "immutable" isn't very useful.
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: Which Elisp types are mutable?
2021-06-05 19:19 ` Marcin Borkowski
2021-06-05 20:17 ` [External] : " Drew Adams
@ 2021-07-05 18:41 ` Philipp
2021-07-05 18:48 ` Eli Zaretskii
1 sibling, 1 reply; 23+ messages in thread
From: Philipp @ 2021-07-05 18:41 UTC (permalink / raw)
To: Marcin Borkowski; +Cc: Help Gnu Emacs mailing list
> 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.
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: Which Elisp types are mutable?
2021-07-05 18:41 ` Philipp
@ 2021-07-05 18:48 ` Eli Zaretskii
2021-07-05 18:55 ` tomas
0 siblings, 1 reply; 23+ messages in thread
From: Eli Zaretskii @ 2021-07-05 18:48 UTC (permalink / raw)
To: help-gnu-emacs
> 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>
>
> > 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.
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.
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: Which Elisp types are mutable?
2021-07-05 18:48 ` Eli Zaretskii
@ 2021-07-05 18:55 ` tomas
2021-07-05 19:26 ` [External] : " Drew Adams
0 siblings, 1 reply; 23+ messages in thread
From: tomas @ 2021-07-05 18:55 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: help-gnu-emacs
[-- Attachment #1: Type: text/plain, Size: 1267 bytes --]
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 #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 198 bytes --]
^ permalink raw reply [flat|nested] 23+ messages in thread
* RE: [External] : Re: Which Elisp types are mutable?
2021-07-05 18:55 ` tomas
@ 2021-07-05 19:26 ` Drew Adams
2021-07-05 19:40 ` tomas
0 siblings, 1 reply; 23+ messages in thread
From: Drew Adams @ 2021-07-05 19:26 UTC (permalink / raw)
To: tomas@tuxteam.de, Eli Zaretskii; +Cc: help-gnu-emacs@gnu.org
> In Emacs Lisp, typical immutable objects are symbols, keywords, numbers
We've been around this block a few times already,
and I don't really want to stir the pot here.
But I'll mention that a Lisp symbol is a kind of
mutable "object". It has various properties, some
of which are predefined (whether or not they have
non-nil values) and any number of which others can
be created. Predefined properties include the
symbol name, value as a variable, and value as a
function.
All except the symbol name can be changed. Is a
symbol something immutable? Not IMO, but the
answer depends on what one means by "immutable".
https://www.gnu.org/software/emacs/manual/html_node/elisp/Symbol-Components.html
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: [External] : Re: Which Elisp types are mutable?
2021-07-05 19:26 ` [External] : " Drew Adams
@ 2021-07-05 19:40 ` tomas
2021-07-05 20:03 ` Drew Adams
0 siblings, 1 reply; 23+ messages in thread
From: tomas @ 2021-07-05 19:40 UTC (permalink / raw)
To: Drew Adams; +Cc: help-gnu-emacs@gnu.org
[-- Attachment #1: Type: text/plain, Size: 699 bytes --]
On Mon, Jul 05, 2021 at 07:26:23PM +0000, Drew Adams wrote:
> > In Emacs Lisp, typical immutable objects are symbols, keywords, numbers
>
> We've been around this block a few times already,
> and I don't really want to stir the pot here.
>
> But I'll mention that a Lisp symbol is a kind of
> mutable "object". It has various properties [...]
Oh, Elisp doesn't differentiate between the symbol proper
and its bindings?
> All except the symbol name can be changed. Is a
> symbol something immutable? Not IMO, but the
> answer depends on what one means by "immutable".
>
> https://www.gnu.org/software/emacs/manual/html_node/elisp/Symbol-Components.html
Thanks :)
-- t
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 198 bytes --]
^ permalink raw reply [flat|nested] 23+ messages in thread
* RE: [External] : Re: Which Elisp types are mutable?
2021-07-05 19:40 ` tomas
@ 2021-07-05 20:03 ` Drew Adams
2021-07-05 20:12 ` tomas
0 siblings, 1 reply; 23+ messages in thread
From: Drew Adams @ 2021-07-05 20:03 UTC (permalink / raw)
To: tomas@tuxteam.de; +Cc: help-gnu-emacs@gnu.org
> > But I'll mention that a Lisp symbol is a kind of
> > mutable "object". It has various properties [...]
>
> Oh, Elisp doesn't differentiate between the symbol proper
> and its bindings?
Sure, it does. Though I may not understand what you
mean by its bindings.
The symbol is an object - a complex/compound thing.
It has various properties. One of the properties is
its value as a variable, which is accessible using
function `symbol-value'. As a variable, that's the
symbol's variable (global) "binding".
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: [External] : Re: Which Elisp types are mutable?
2021-07-05 20:03 ` Drew Adams
@ 2021-07-05 20:12 ` tomas
2021-07-05 20:39 ` Drew Adams
0 siblings, 1 reply; 23+ messages in thread
From: tomas @ 2021-07-05 20:12 UTC (permalink / raw)
To: Drew Adams; +Cc: help-gnu-emacs@gnu.org
[-- Attachment #1: Type: text/plain, Size: 848 bytes --]
On Mon, Jul 05, 2021 at 08:03:14PM +0000, Drew Adams wrote:
> > > But I'll mention that a Lisp symbol is a kind of
> > > mutable "object". It has various properties [...]
> >
> > Oh, Elisp doesn't differentiate between the symbol proper
> > and its bindings?
>
> Sure, it does. Though I may not understand what you
> mean by its bindings.
>
> The symbol is an object - a complex/compound thing.
> It has various properties. One of the properties is
> its value as a variable, which is accessible using
> function `symbol-value'. As a variable, that's the
> symbol's variable (global) "binding".
Hm. If you change a variable's value... does that count
as "mutating the symbol"? If you change the binding (e.g.
by entering another scope or by leaving it)?
Yes, there are those other pesky properties...
Cheers
- t
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 198 bytes --]
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: Which Elisp types are mutable?
2021-07-05 18:40 ` Philipp
@ 2021-07-05 20:19 ` Stefan Monnier
2021-07-05 20:44 ` Emanuel Berg via Users list for the GNU Emacs text editor
0 siblings, 1 reply; 23+ messages in thread
From: Stefan Monnier @ 2021-07-05 20:19 UTC (permalink / raw)
To: Philipp; +Cc: help-gnu-emacs
Philipp [2021-07-05 20:40:01] wrote:
>> Am 05.06.2021 um 16:25 schrieb Stefan Monnier via Users list for the GNU
>> Emacs text editor <help-gnu-emacs@gnu.org>:
>>> "You must not mutate them" is the definition of immutable.
>> Not necessarily: where I come from "immutable" means that the object
>> cannot and will not be mutated.
> Then there are no immutable objects, because all objects are stored in
> mutable memory.
You're confusing a language and its implementation.
E.g. ELisp bytecode objects are immutable vectors. Technically there is
some potential way to mutate them because they're stored in the normal
mutable memory, but efforts were made so that ELisp code cannot
mutate them.
For the same reason, ELisp code cannot "transmute" a marker into an
overlay, even though nothing stops you from doing it at the C level.
> So this definition of "immutable" isn't very useful.
I think most language designers would beg to differ.
Stefan
^ permalink raw reply [flat|nested] 23+ messages in thread
* RE: [External] : Re: Which Elisp types are mutable?
2021-07-05 20:12 ` tomas
@ 2021-07-05 20:39 ` Drew Adams
2021-07-05 20:58 ` Emanuel Berg via Users list for the GNU Emacs text editor
0 siblings, 1 reply; 23+ messages in thread
From: Drew Adams @ 2021-07-05 20:39 UTC (permalink / raw)
To: tomas@tuxteam.de; +Cc: help-gnu-emacs@gnu.org
> Hm. If you change a variable's value... does that count
> as "mutating the symbol"? If you change the binding (e.g.
> by entering another scope or by leaving it)?
(Changing a symbol's binding, with `let' etc.
is more complicated. I mentioned global value.)
If you look at a Lisp symbol as being an object
with properties, then yes; changing its variable
value changes the object - its mutable state.
There's nothing very special involved here. It's
just that people unused to Lisp won't necessarily
think that a symbol is a complex thing, and that
it "owns" its value as a variable (and its value
as a function, which for a Lisp-2 is separate).
The symbol is not its name. In many languages
you have only to think about a name and its
binding to a value. At a lower level you think
of a memory location (address) and the value at
that address.
In Lisp a source-code name can refer to a symbol
object. That object itself has other things /
properties, besides a value as a variable.
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: Which Elisp types are mutable?
2021-07-05 20:19 ` Stefan Monnier
@ 2021-07-05 20:44 ` Emanuel Berg via Users list for the GNU Emacs text editor
2021-07-05 20:58 ` Stefan Monnier via Users list for the GNU Emacs text editor
0 siblings, 1 reply; 23+ messages in thread
From: Emanuel Berg via Users list for the GNU Emacs text editor @ 2021-07-05 20:44 UTC (permalink / raw)
To: help-gnu-emacs
Stefan Monnier wrote:
>> So this definition of "immutable" isn't very useful.
>
> I think most language designers would beg to differ.
What would you say is the "problem" with Elisp?
And is this at the implementation or language level?
--
underground experts united
https://dataswamp.org/~incal
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: Which Elisp types are mutable?
2021-07-05 20:44 ` Emanuel Berg via Users list for the GNU Emacs text editor
@ 2021-07-05 20:58 ` Stefan Monnier via Users list for the GNU Emacs text editor
2021-07-05 21:03 ` Emanuel Berg via Users list for the GNU Emacs text editor
0 siblings, 1 reply; 23+ messages in thread
From: Stefan Monnier via Users list for the GNU Emacs text editor @ 2021-07-05 20:58 UTC (permalink / raw)
To: help-gnu-emacs
Emanuel Berg via Users list for the GNU Emacs text editor [2021-07-05 22:44:11] wrote:
> Stefan Monnier wrote:
>>> So this definition of "immutable" isn't very useful.
>> I think most language designers would beg to differ.
> What would you say is the "problem" with Elisp?
It's too sexy for its shirt,
Stefan
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: [External] : Re: Which Elisp types are mutable?
2021-07-05 20:39 ` Drew Adams
@ 2021-07-05 20:58 ` Emanuel Berg via Users list for the GNU Emacs text editor
0 siblings, 0 replies; 23+ messages in thread
From: Emanuel Berg via Users list for the GNU Emacs text editor @ 2021-07-05 20:58 UTC (permalink / raw)
To: help-gnu-emacs
Drew Adams wrote:
>> Hm. If you change a variable's value... does that count as
>> "mutating the symbol"? If you change the binding (e.g.
>> by entering another scope or by leaving it)?
>
> (Changing a symbol's binding, with `let' etc. is more
> complicated. I mentioned global value.)
>
> If you look at a Lisp symbol as being an object with
> properties, then yes; changing its variable value changes
> the object - its mutable state.
You can change the symbol as a practically employed instance
but not as a concept...
--
underground experts united
https://dataswamp.org/~incal
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: Which Elisp types are mutable?
2021-07-05 20:58 ` Stefan Monnier via Users list for the GNU Emacs text editor
@ 2021-07-05 21:03 ` Emanuel Berg via Users list for the GNU Emacs text editor
0 siblings, 0 replies; 23+ messages in thread
From: Emanuel Berg via Users list for the GNU Emacs text editor @ 2021-07-05 21:03 UTC (permalink / raw)
To: help-gnu-emacs
Stefan Monnier via Users list for the GNU Emacs text editor wrote:
>> What would you say is the "problem" with Elisp?
>
> It's too sexy for its shirt,
Haha, maybe...
--
underground experts united
https://dataswamp.org/~incal
^ permalink raw reply [flat|nested] 23+ messages in thread
end of thread, other threads:[~2021-07-05 21:03 UTC | newest]
Thread overview: 23+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-06-03 4:03 Which Elisp types are mutable? Marcin Borkowski
2021-06-03 12:11 ` Philipp
2021-06-05 11:22 ` Marcin Borkowski
2021-06-05 12:58 ` Philipp
2021-06-05 14:25 ` Stefan Monnier via Users list for the GNU Emacs text editor
2021-07-05 18:40 ` Philipp
2021-07-05 20:19 ` Stefan Monnier
2021-07-05 20:44 ` Emanuel Berg via Users list for the GNU Emacs text editor
2021-07-05 20:58 ` Stefan Monnier via Users list for the GNU Emacs text editor
2021-07-05 21:03 ` Emanuel Berg via Users list for the GNU Emacs text editor
2021-06-05 19:19 ` Marcin Borkowski
2021-06-05 20:17 ` [External] : " Drew Adams
2021-06-05 20:36 ` Dmitry Gutov
2021-06-06 1:57 ` Drew Adams
2021-07-05 18:41 ` Philipp
2021-07-05 18:48 ` Eli Zaretskii
2021-07-05 18:55 ` tomas
2021-07-05 19:26 ` [External] : " Drew Adams
2021-07-05 19:40 ` tomas
2021-07-05 20:03 ` Drew Adams
2021-07-05 20:12 ` tomas
2021-07-05 20:39 ` Drew Adams
2021-07-05 20:58 ` Emanuel Berg via Users list for the GNU Emacs text editor
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).