From: Nix <nix@esperi.org.uk>
To: Tom Tromey <tromey@redhat.com>
Cc: Emacs Dev <emacs-devel@gnu.org>, Juri Linkov <juri@jurta.org>,
martin rudalics <rudalics@gmx.at>,
PJ Weisberg <pjweisberg@gmail.com>,
"Stephen J. Turnbull" <stephen@xemacs.org>,
Alin Soare <as1789@gmail.com>
Subject: Re: Tabs are ready? -> Let us give a definition of tabs.
Date: Mon, 13 Feb 2012 18:50:42 +0000 [thread overview]
Message-ID: <87r4xyva7x.fsf@spindle.srvr.nix> (raw)
In-Reply-To: <87vcnan1aa.fsf@fleche.redhat.com> (Tom Tromey's message of "Mon, 13 Feb 2012 09:30:53 -0700")
On 13 Feb 2012, Tom Tromey outgrape:
>>>>>> "Nix" == Nix <nix@esperi.org.uk> writes:
>
> Nix> Well, yes, but that's really *because* nobody could figure out
> Nix> consistent and unsurprising semantics regarding the interaction of
> Nix> *-local variables with (let ...). That problem remains: it's there even
> Nix> for buffer-locals, which we are surely not planning to deprecate.
>
> What are the problems with just buffer-locals? I thought they were
> pretty well-defined.
Agreed, but that doesn't mean they're not problematic.
> There's some text and an example in the manual
> that explains the weird case. If there are other weird cases, I would
> like to know what they are.
See, the intuitive definition of buffer-locals would have them nesting
just underneath the global scope, so they would never ever supplant let
bindings. I can't imagine anyone actually wanting the current semantics:
they are purely an implementation artifact.
Can you recall any elisp code that establishes let bindings, switches
buffers, then operates under the assumption that some or all of its let
bindings or parameters may have changed? Because that's what we should
be doing if we actually think those semantics make sense and don't want
our elisp code broken by users establishing whatever buffer-local
bindings they like. Nobody actually codes that way, because it would be
insane. Instead we *hope* that nobody establishes makes variables
buffer-local whose names overlap the names of any local variables or
parameters. Generally, we are lucky (and it is actually quite hard to
contrive a case that is broken by the current rules). But this is hardly
ideal!
More worryingly, if you choose the wrong name for your buffer-local
variable, parameters and local bindings will smash it out of hand, with
no warnings at all. *This* is easy to contrive a test for: just try
assigning a local value to a buffer-local variable named 'start': it
doesn't even survive a round of C-h v and quit-window!
We may be saved here by the relatively large size of the space available
for names, and by the fact that mostly it is Lisp code that establishes
new global and buffer-local bindings, not users. But it is still icky
and feels *wrong* and generally makes my correctness-inclined skin
crawl.
> Once you add other kinds of locals you have to decide how they all
> interact.
Yep. That's what I meant by someone having to sit down and define the
semantics of this sort of thing before adding any new types of
locally-scoped variable. But the behaviour of buffer-locals is, to be
honest, already a bug, documented or not. You can break all sorts of
core Emacs functions with M-x make-local-variable, which is not
documented nor expected by users who do it.
> That is a lot harder than just defining how buffer-locals
> act.
Unfortunately they do not currently act in a way I would consider
consistent. "The global value is global, the local value is less local
than 'let' unless you switch buffers inside a 'let' whereupon it is
suddenly more local than 'let', even if you switch back again" is not
sane. It happens to be easy to implement, but it doesn't follow anything
I would consider normal scoping rules for any language.
It so happens that this rarely causes trouble. But *ick*.
--
NULL && (void)
next prev parent reply other threads:[~2012-02-13 18:50 UTC|newest]
Thread overview: 71+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-02-04 22:36 Tabs are ready? -> Let us give a definition of tabs Alin Soare
2012-02-05 10:42 ` martin rudalics
2012-02-05 12:44 ` Alin Soare
2012-02-05 13:17 ` martin rudalics
2012-02-05 13:39 ` Alin Soare
[not found] ` <CA+Xtq3U5PkH=m1ZRMMm2LJQ_BHZXc08Vk4TbhNyyFLta+1EkBw@mail.gmail.com>
2012-02-05 13:44 ` Fwd: " Alin Soare
2012-02-05 14:50 ` Alin Soare
2012-02-05 17:56 ` Andy Moreton
2012-02-05 18:51 ` Drew Adams
2012-02-06 3:35 ` Stephen J. Turnbull
2012-02-05 18:16 ` martin rudalics
2012-02-05 21:33 ` Alin Soare
2012-02-06 10:35 ` martin rudalics
2012-02-06 13:21 ` Alin Soare
2012-02-05 23:56 ` Alin Soare
2012-02-06 10:36 ` martin rudalics
2012-02-06 13:34 ` Alin Soare
2012-02-06 14:46 ` Stephen J. Turnbull
2012-02-06 16:18 ` Alin Soare
2012-02-06 16:21 ` Alin Soare
2012-02-06 17:53 ` Stephen J. Turnbull
2012-02-06 22:51 ` Alin Soare
2012-02-06 22:55 ` Alin Soare
2012-02-07 16:15 ` Stephen J. Turnbull
2012-02-09 15:55 ` PJ Weisberg
2012-02-09 16:11 ` Alin Soare
2012-02-09 16:16 ` Alin Soare
2012-02-10 19:04 ` Alin Soare
2012-02-10 19:08 ` Alin Soare
2012-02-11 14:16 ` Nix
2012-02-11 14:41 ` Alin Soare
2012-02-12 13:40 ` Nix
2012-02-12 16:23 ` Alin Soare
2012-02-12 18:48 ` Alin Soare
2012-02-13 6:06 ` Stephen J. Turnbull
2012-02-13 12:29 ` Nix
2012-02-13 15:53 ` Tom Tromey
2012-02-13 16:21 ` Nix
2012-02-13 16:30 ` Tom Tromey
2012-02-13 18:50 ` Nix [this message]
2012-02-15 20:35 ` Tom Tromey
2012-02-15 22:59 ` Stefan Monnier
2012-02-15 23:03 ` Nix
2012-02-28 15:13 ` Alin Soare
2012-02-28 15:16 ` Alin Soare
2012-02-13 13:24 ` Stefan Monnier
2012-02-13 13:49 ` Nix
2012-02-13 15:20 ` Stefan Monnier
2012-02-13 16:21 ` Nix
2012-02-06 18:00 ` martin rudalics
2012-02-06 17:05 ` martin rudalics
2012-02-05 18:15 ` martin rudalics
2012-02-05 21:38 ` Alin Soare
2012-02-05 22:30 ` joakim
2012-02-05 22:53 ` Alin Soare
2012-02-06 10:35 ` martin rudalics
2012-02-06 13:25 ` Alin Soare
2012-02-06 17:03 ` martin rudalics
2012-02-06 19:19 ` Nix
2012-02-06 19:43 ` martin rudalics
2012-02-06 19:45 ` Nix
2012-02-06 19:54 ` Drew Adams
2012-02-08 23:43 ` Alin Soare
2012-02-09 11:19 ` Nix
2012-02-09 13:05 ` Alin Soare
2012-02-09 13:07 ` Alin Soare
2012-02-07 15:57 ` Stephen J. Turnbull
2012-02-07 17:15 ` Nix
2012-02-06 20:05 ` Alin Soare
2012-02-07 16:03 ` Stephen J. Turnbull
2012-02-06 17:04 ` martin rudalics
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=87r4xyva7x.fsf@spindle.srvr.nix \
--to=nix@esperi.org.uk \
--cc=as1789@gmail.com \
--cc=emacs-devel@gnu.org \
--cc=juri@jurta.org \
--cc=pjweisberg@gmail.com \
--cc=rudalics@gmx.at \
--cc=stephen@xemacs.org \
--cc=tromey@redhat.com \
/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).