unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Alan Mackenzie <acm@muc.de>
To: Eli Zaretskii <eliz@gnu.org>
Cc: 30241@debbugs.gnu.org
Subject: bug#30241: Emacs 26.0.91: "Generalized variables" are not defined.
Date: Tue, 20 Mar 2018 20:51:31 +0000	[thread overview]
Message-ID: <20180320205131.GB16673@ACM> (raw)
In-Reply-To: <83inb31pp0.fsf@gnu.org>

Hello, Eli.

Maybe there's still a chance to get this doc fix into Emacs 26.  What do
you say?

On Sun, Feb 11, 2018 at 18:00:43 +0200, Eli Zaretskii wrote:
> > Date: Sat, 10 Feb 2018 21:58:41 +0000
> > Cc: Drew Adams <drew.adams@oracle.com>, 30241@debbugs.gnu.org
> > From: Alan Mackenzie <acm@muc.de>

> > I've read https://www.cs.cmu.edu/Groups/AI/html/cltl/clm/node80.html,
> > and found it clear indeed.  However it was also long.  After reading it,
> > the Elisp sections on generalised variables make much more sense.

> > This suggests that these Elisp sections contain the material, but are
> > not suitable for readers who don't already understand generalised
> > variables.

> > In that CL page, a generalised variable is effectively defined as
> > something you can use `setf' on within the first three paragraphs.  In
> > the elisp sections, that identification is not present in the opening
> > paragraphs - there is no definition on that opening page.  The first
> > sub-page does not define a generalised variable as something you can use
> > setf on - it merely says setf is a way to access one.  But that
> > definition needs to be in the top level page, and it needs to be clear
> > that it _is_ a definition.

> It seems strange to me to define something in terms of its uses, but
> if people think this is better than the other way around, I don't
> mind.

> Can you propose how to change what we have now to include what you
> think should be there?

A proposed patch is below.

> > The CL page gives a complete list of forms setf will work with.  The
> > elisp page merely gives a list, without it being clear whether that list
> > is complete or not.

> It's supposed to be a complete list, but if someone knows of other
> forms, let them speak up.

OK, I've made this clear in the patch.

A quick summary of what I've changed:
(i) a GV is defined as something `setf' can be used to store into.
(ii) I've removed the insinuation that hackers would have difficulty
remembering two functions (a get and a set) rather than just one.
(iii) I've made clear that the list of GVs in the page is complete.
(iv) I've removed the suggestion that setf has superseded, or is in
the process of superseding, setq.
(v) I've made minor corrections to the English.



diff --git a/doc/lispref/variables.texi b/doc/lispref/variables.texi
index e025d3fd10..355cf5a09a 100644
--- a/doc/lispref/variables.texi
+++ b/doc/lispref/variables.texi
@@ -2316,11 +2316,12 @@ Generalized Variables
 
 @cindex generalized variable
 @cindex place form
-A @dfn{generalized variable} or @dfn{place form} is one of the many places
-in Lisp memory where values can be stored.  The simplest place form is
-a regular Lisp variable.  But the @sc{car}s and @sc{cdr}s of lists, elements
-of arrays, properties of symbols, and many other locations are also
-places where Lisp values are stored.
+A @dfn{generalized variable} or @dfn{place form} is one of the many
+places in Lisp memory where values can be stored using the @code{setf}
+macro (@pxref{Setting Generalized Variables}).  The simplest place
+form is a regular Lisp variable.  But the @sc{car}s and @sc{cdr}s of
+lists, elements of arrays, properties of symbols, and many other
+locations are also places where Lisp values get stored.
 
 Generalized variables are analogous to lvalues in the C
 language, where @samp{x = a[i]} gets an element from an array
@@ -2341,8 +2342,8 @@ Setting Generalized Variables
 accepts arbitrary place forms on the left side rather than just
 symbols.  For example, @code{(setf (car a) b)} sets the car of
 @code{a} to @code{b}, doing the same operation as @code{(setcar a b)},
-but without having to remember two separate functions for setting and
-accessing every type of place.
+but without you having to use two separate functions for setting and
+accessing this type of place.
 
 @defmac setf [place form]@dots{}
 This macro evaluates @var{form} and stores it in @var{place}, which
@@ -2352,18 +2353,19 @@ Setting Generalized Variables
 @var{form}.
 @end defmac
 
-The following Lisp forms will work as generalized variables, and
-so may appear in the @var{place} argument of @code{setf}:
+The following Lisp forms are the forms in Emacs that will work as
+generalized variables, and so may appear in the @var{place} argument
+of @code{setf}:
 
 @itemize
 @item
-A symbol naming a variable.  In other words, @code{(setf x y)} is
-exactly equivalent to @code{(setq x y)}, and @code{setq} itself is
-strictly speaking redundant given that @code{setf} exists.  Many
-programmers continue to prefer @code{setq} for setting simple
-variables, though, purely for stylistic or historical reasons.
-The macro @code{(setf x y)} actually expands to @code{(setq x y)},
-so there is no performance penalty for using it in compiled code.
+A symbol.  In other words, @code{(setf x y)} is exactly equivalent to
+@code{(setq x y)}, and @code{setq} itself is strictly speaking
+redundant given that @code{setf} exists.  Most programmers will
+continue to prefer @code{setq} for setting simple variables, though,
+for stylistic and historical reasons.  The macro @code{(setf x y)}
+actually expands to @code{(setq x y)}, so there is no performance
+penalty for using it in compiled code.
 
 @item
 A call to any of the following standard Lisp functions:


> Thanks.

-- 
Alan Mackenzie (Nuremberg, Germany).





  reply	other threads:[~2018-03-20 20:51 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
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 [this message]
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=20180320205131.GB16673@ACM \
    --to=acm@muc.de \
    --cc=30241@debbugs.gnu.org \
    --cc=eliz@gnu.org \
    /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).