emacs-devel
[Top][All Lists]
Advanced

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

Re: Can't M-x compile-defun `edebug' because dynamic variables are false


From: Stefan Monnier
Subject: Re: Can't M-x compile-defun `edebug' because dynamic variables are falsely taken as lexical.
Date: Fri, 14 Feb 2020 14:19:13 -0500
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

> The real point was about `defvar'.  CL's `defvar' is
> not Emacs's, AFAIU.

That's a given.  But I thought the point was about Emacs's doc.

>> In Common Lisp
>> 
>>    (list
>>      (lambda (x)
>>        (let ((y x))
>>          (declare (special y))
>>          (lambda (z) (+ y z))))
>>      (lambda (x)
>>        (let ((y x))
>>          (lambda (z) (+ y z)))))
>> 
>> gives you two functions that don't behave the same because the `y`
>> binding in the first is dynamically scoped whereas that same `y`
>> binding is statically scoped in the second.
>
> In CL parlance, those are not only not the same binding,
> they are not the same variable `y'.  That's the point.

Not really, no: what the user wants to know is "when I write (let ((y
...)) ...), when will binding be dynamic or lexical".
Whether or not it's "the same variable" as some other
is irrelevant, or more specifically, it just shifts the problem.

> The first variable named `y' is special, which means
> that it's special everywhere (indefinite scope), and
> it's duration is the duration of the executing code
> that uses it (dynamic extent).

E.g. here it just shifts the problem from "which y will be lexical and
which will be dynamic" to "which y corresponds to this one-and-only
special var and which doesn't".


        Stefan




reply via email to

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