unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Stefan Monnier <monnier@iro.umontreal.ca>
To: Drew Adams <drew.adams@oracle.com>
Cc: Alan Mackenzie <acm@muc.de>, emacs-devel@gnu.org
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	[thread overview]
Message-ID: <jwv7e0poue8.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <9a1d6af0-7561-4679-930c-3bcda6169764@default> (Drew Adams's message of "Fri, 14 Feb 2020 09:25:00 -0800 (PST)")

> 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	other threads:[~2020-02-14 19:19 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-01-03 14:14 Can't M-x compile-defun `edebug' because dynamic variables are falsely taken as lexical Alan Mackenzie
2017-01-03 18:35 ` Stefan Monnier
2017-01-03 21:32   ` Alan Mackenzie
2017-01-03 21:48     ` Stefan Monnier
2017-01-04 13:39       ` Alan Mackenzie
2017-01-04 15:23         ` Stefan Monnier
2017-01-04 20:04           ` Alan Mackenzie
2017-01-04 21:49             ` Stefan Monnier
2017-01-04 22:02               ` Alan Mackenzie
2017-01-04 22:26                 ` Stefan Monnier
2017-01-04 22:44                   ` Drew Adams
2017-01-05 10:54                   ` Alan Mackenzie
2020-02-13 16:42             ` Drew Adams
2020-02-13 20:02               ` Stefan Monnier
2020-02-13 20:43                 ` Drew Adams
2020-02-13 22:09                   ` Stefan Monnier
2020-02-14  1:07                     ` Drew Adams
2020-02-14  2:24                       ` Stefan Monnier
2020-02-14 17:25                         ` Drew Adams
2020-02-14 19:19                           ` Stefan Monnier [this message]
2020-02-17 18:23                           ` Drew Adams
2020-02-13 22:11                   ` Stefan Monnier
2020-02-14  1:13                     ` 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=jwv7e0poue8.fsf-monnier+emacs@gnu.org \
    --to=monnier@iro.umontreal.ca \
    --cc=acm@muc.de \
    --cc=drew.adams@oracle.com \
    --cc=emacs-devel@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).