all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Drew Adams <drew.adams@oracle.com>
To: phillip.lord@newcastle.ac.uk
Cc: help-gnu-emacs@gnu.org, "Kai Großjohann" <kai.grossjohann@gmx.net>
Subject: RE: DynamicBindingVsLexicalBinding
Date: Mon, 14 Oct 2013 06:45:44 -0700 (PDT)	[thread overview]
Message-ID: <20367a8e-c17c-4a10-8934-b5a24f2cddf0@default> (raw)
In-Reply-To: <87txgk85em.fsf@zerg32.ncl.ac.uk>

> > Yes.  Which is especially important for a heavily interactive and
> > customizable program such as Emacs.  Emacs users extend and
> > otherwise modify or adapt the source code, and they do so sometimes
> > on the fly and interactively.
> 
> I don't think this is an advantage of dynamic binding; it's just an
> advantage of having lots of configuration options.

Which are dynamically bound variables.  Perhaps you are not as lexical
as you think. ;-)

Do you mean that you are OK with assigning values to such global,
dynamically bound variables at startup time, and you are OK with a
user changing their values interactively anytime (e.g. using Customize),
but you are not OK with code let-binding global, dynamically bound
variables?  Assignment is OK by you, but not let-binding?

> I've certainly used the feature that Kai likes, but mostly it has
> been to hack around code which I do not control or do not want to
> change.  Nowadays, in general, I would want to advice code instead.

http://www.gnu.org/software/emacs/emacs-paper.html#SEC17  (Richard
Stallman, 1981), including:

"Formal Parameters Cannot Replace Dynamic Scope

 Some language designers believe that dynamic binding should be avoided,
 and explicit argument passing should be used instead. Imagine that
 function A binds the variable FOO, and calls the function B, which
 calls the function C, and C uses the value of FOO. Supposedly A should
 pass the value as an argument to B, which should pass it as an argument
 to C. 

 This cannot be done in an extensible system, however, because the author
 of the system cannot know what all the parameters will be. Imagine that
 the functions A and C are part of a user extension, while B is part of
 the standard system. The variable FOO does not exist in the standard
 system; it is part of the extension. To use explicit argument passing
 would require adding a new argument to B, which means rewriting B and
 everything that calls B. In the most common case, B is the editor
 command dispatcher loop, which is called from an awful number of places. 

 What's worse, C must also be passed an additional argument. B doesn't
 refer to C by name (C did not exist when B was written). It probably
 finds a pointer to C in the command dispatch table. This means that
 the same call which sometimes calls C might equally well call any
 editor command definition. So all the editing commands must be
 rewritten to accept and ignore the additional argument. By now, none
 of the original system is left!"



  reply	other threads:[~2013-10-14 13:45 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-10-12 17:56 DynamicBindingVsLexicalBinding Andreas Röhler
2013-10-12 18:35 ` DynamicBindingVsLexicalBinding Dmitry Gutov
2013-10-12 20:53   ` DynamicBindingVsLexicalBinding Drew Adams
2013-10-13  5:09     ` DynamicBindingVsLexicalBinding Thien-Thi Nguyen
2013-10-13  7:54   ` DynamicBindingVsLexicalBinding Andreas Röhler
2013-10-13 13:46     ` DynamicBindingVsLexicalBinding Kai Großjohann
2013-10-13 16:21       ` DynamicBindingVsLexicalBinding Drew Adams
2013-10-14 11:21         ` DynamicBindingVsLexicalBinding Phillip Lord
2013-10-14 13:45           ` Drew Adams [this message]
2013-10-14 16:05             ` DynamicBindingVsLexicalBinding Phillip Lord
2013-10-14 21:32           ` DynamicBindingVsLexicalBinding Kai Großjohann
2013-10-15 11:27             ` DynamicBindingVsLexicalBinding Phillip Lord
2013-10-15 20:43               ` DynamicBindingVsLexicalBinding Kai Großjohann
2013-10-16 12:57                 ` DynamicBindingVsLexicalBinding Phillip Lord
     [not found]                 ` <mailman.4127.1381928277.10748.help-gnu-emacs@gnu.org>
2013-10-16 14:26                   ` DynamicBindingVsLexicalBinding Barry Margolin
     [not found]       ` <mailman.3929.1381681317.10748.help-gnu-emacs@gnu.org>
2013-10-14 11:27         ` DynamicBindingVsLexicalBinding Rustom Mody
2013-10-14 11:15 ` DynamicBindingVsLexicalBinding Phillip Lord
     [not found] <mailman.3891.1381600459.10748.help-gnu-emacs@gnu.org>
2013-10-13  3:34 ` DynamicBindingVsLexicalBinding Barry Margolin

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

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20367a8e-c17c-4a10-8934-b5a24f2cddf0@default \
    --to=drew.adams@oracle.com \
    --cc=help-gnu-emacs@gnu.org \
    --cc=kai.grossjohann@gmx.net \
    --cc=phillip.lord@newcastle.ac.uk \
    /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 external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.