unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Drew Adams <drew.adams@oracle.com>
To: Alan Mackenzie <acm@muc.de>, 30241@debbugs.gnu.org
Subject: bug#30241: Emacs 26.0.91: "Generalized variables" are not defined.
Date: Wed, 24 Jan 2018 13:25:27 -0800 (PST)	[thread overview]
Message-ID: <e3468d0d-4ee5-4173-9a0d-051803a8cf08@default> (raw)
In-Reply-To: <20180124200652.GA4493@ACM>

> Emacs 25.3, Emacs 26.0.91 elisp manual.
> 
> In enough places in emacs, we find terms like "generalized variable"
> "place form", and "place" being used.  These terms are not defined in
> the Elisp manual, or any place where they are used.  This is a bug.
> 
> There is a page in elisp which purports to define "generalized
> variable", but rather than defining the term, it talks vaguely around
> it, saying it is "one of the many places in Lisp memory where values can
> be stored".  Does this mean it is different from the other such places?
> If so, how does it differ.  WHAT IS IT????
> 
> The elisp page then goes on to give examples of "generalized variables",
> never defining the term.  It gives no criterion by which the reader can
> determine whether some random object is a generalized variable or not.
> 
> I want to know whether a function is a "generalized variable".  After a
> long time trying to find out, I still don't know.  I've been trying for
> over an hour to use add-function, with forms like
> 
>     (add-function :before sit-for (lambda () (acm-backtrace 5)))
>     (add-function :before 'sit-for (....))
>     (add-function :before #'sit-for (.....))
>     (add-function :before (symbol-function 'sit-for) (....))
> 
> , and got nothing but unhelpful error messages back, such as
> 
>     Symbol's value as variable is void: sit-for
> 
> .  The documentation of add-function is likewise vague and unhelpful.
> The various inflections of "sit-for" above are at a place in the
> add-function form where a "generalized variable" is needed.  Is a
> function a generalized variable or not?

Hear, hear.

This is a more general problem, for all of our Common Lisp
emulation or Cl-inspired stuff.  (Not that the Emacs
implementation of generalized vars actually emulates what
Common Lisp has for generalized vars.)

When Emacs has something more or less borrowed or inspired
from Common Lisp, the Emacs doc explaining it (e.g. the
concepts) is sometimes somewhat paltry.  In such cases, you
it can help to (1) know that Emacs was inspired by Common
Lisp for that construct and (2) consult the Common Lisp doc.

To learn about generalized variables I think you need to
consult the Common Lisp doc, which is quite clear about it:

https://www.cs.cmu.edu/Groups/AI/html/cltl/clm/node80.html

"The concept of variables named by symbols can be generalized to
any storage location that can remember one piece of data, no
matter how that location is named. Examples of such storage
locations are the car and cdr of a cons, elements of an array,
and components of a structure."

When you hear "generalized variable" just think `setf'.

For Emacs, we could conceivably have many more generalized
vars than we have now.  We might make it possible to use
`setf' for functions like these, for instance: `point',
`selected-* (*=...), `point-min|max', `current-*', ...

Not that we need that, but it could sometimes be useful.

In most cases it just provides a uniform way to change
something.  E.g., (setf (current-local-map) my-map)
instead of (use-local-map my-map).  The old Emacs update
functions are often simpler, but using `setf' means you
don't need to know the setter/update function; you just
need to know the getter/access function.





  parent reply	other threads:[~2018-01-24 21:25 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-24 20:06 bug#30241: Emacs 26.0.91: "Generalized variables" are not defined Alan Mackenzie
2018-01-24 20:49 ` Noam Postavsky
2018-01-24 21:25 ` Drew Adams [this message]
2018-01-24 21:38   ` Noam Postavsky
2018-01-24 21:43     ` Drew Adams
2018-01-26 14:16   ` Eli Zaretskii
2018-01-26 16:15     ` Drew Adams
2018-01-27 10:34       ` Eli Zaretskii
2018-02-02 10:33         ` Eli Zaretskii
2018-02-10 11:24           ` Eli Zaretskii
2018-02-10 21:58         ` Alan Mackenzie
2018-02-10 22:54           ` Drew Adams
2018-02-11 20:43             ` Richard Stallman
2018-02-11 16:00           ` Eli Zaretskii
2018-03-20 20:51             ` Alan Mackenzie
2018-03-21  6:17               ` Eli Zaretskii
     [not found] ` <handler.30241.B.15168248834946.ack@debbugs.gnu.org>
2018-03-21 17:46   ` bug#30241: (Emacs 26.0.91: "Generalized variables" are not defined.) Alan Mackenzie
     [not found] <<20180124200652.GA4493@ACM>
     [not found] ` <<e3468d0d-4ee5-4173-9a0d-051803a8cf08@default>
     [not found]   ` <<83h8r8ln7u.fsf@gnu.org>
     [not found]     ` <<41654c7c-2d8d-44ec-a5c4-dd12014b7a9e@default>
     [not found]       ` <<83o9lfk2sy.fsf@gnu.org>
2018-01-27 15:31         ` bug#30241: Emacs 26.0.91: "Generalized variables" are not defined Drew Adams

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=e3468d0d-4ee5-4173-9a0d-051803a8cf08@default \
    --to=drew.adams@oracle.com \
    --cc=30241@debbugs.gnu.org \
    --cc=acm@muc.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

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).