emacs-devel
[Top][All Lists]
Advanced

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

Re: master baf1a7a4a0: Turn gv-synthetic-place into a function


From: Michael Heerdegen
Subject: Re: master baf1a7a4a0: Turn gv-synthetic-place into a function
Date: Wed, 21 Sep 2022 15:52:42 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux)

Emanuel Berg <incal@dataswamp.org> writes:

> Michael Heerdegen wrote:
>
> > A generalized variable is a place (form). You use a function
> > in a place form like you use it in any (normal) form.
> > Just the semantics are different. Like in
> >
> >   (car (gv-synthetic-place ...))
>
> OK, so we have symbols that have one slot for a/the function
> and another for the variable and this is some third
> thing then?

Not really.  Note that `gv-synthetic-place' is a corner case
construct that is useful mostly as a helper or to implement support for
more common generalized variables.  There are currently 0 uses in Emacs.

For place forms in general: the idea is that the language allows you to wrap
a normal form that describes the place of a value - like e.g.
(car (alist-get ...))) - into `setf' (or any other place macro) and that
magically allows you to modify or bind that value.  With other words: you
abstract over the concepts "getter" and "setter" functions, since they
are mirror images in a larger concept, and get something _simpler_: you
then need to remember less function names and are allowed to write
simpler code.

Place forms are like normal forms, but only forms that describe the
place of a value and have support as generalized variables are valid as
place forms.  The semantics are different of course since they are not
exactly evaluated like normal Lisp.  They are transformed before
evaluation happens, but that is something very common in Lisp.  Lisp
programmers are used to the fact that not every list in a Lisp program
is evaluated in the standard way.  Think of arguments macros and special
forms.  Not everything is an expression. (1 2) in '(1 2) is not an
expression meant for evaluation, for example.

For place forms you even don't have to learn new syntax.  There is no
additional third thing where stuff is stored...so I would say my
answer to your question is "no".

Please don't get distracted by the discussion of this internal corner
case thing.

Michael.




reply via email to

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