emacs-diffs
[Top][All Lists]
Advanced

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

Re: [Emacs-diffs] /srv/bzr/emacs/trunk r106923: Update Variables chapter


From: Stefan Monnier
Subject: Re: [Emacs-diffs] /srv/bzr/emacs/trunk r106923: Update Variables chapter of Lisp manual to handle lexical binding.
Date: Wed, 25 Jan 2012 08:39:10 -0500
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.92 (gnu/linux)

>>> +value under the default @dfn{dynamic binding} rules.  Under
>>> address@hidden binding} rules, the value cell holds the variable's
>>> address@hidden value}.  @xref{Variable Scoping}, for details.}.
>> A locally scoped variable will normally always have a void value cell
>> (there is no "global value" for them).
> I was trying to refer to the fact that the value cell can be set and
> retrieved separately:

Yes, I think we should say that more explicitly: the variable and the
symbol are two different things.

> (let ((x 2))
>   (set 'x 1)
>   (list x (symbol-value 'x)))
> ---> (2 1)

> Do you think saying "dynamic value" instead would be clearer?  Or that
> this should not be mentioned at all?

The text quoted above is actually technically not too far from the
truth: outside of any let-binding (aka "globally") a lexically-scoped
variable's value is in its symbol's value cell.

This property is (ab?)used to define `pi' (in float-sup.el), which wants to
have a default/global value but also wants to be lexically scoped.
But I don't think it's worth the trouble mentioning it.


        Stefan



reply via email to

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