help-gnu-emacs
[Top][All Lists]
Advanced

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

Re: Real-life examples of lexical binding in Emacs Lisp


From: Andreas Röhler
Subject: Re: Real-life examples of lexical binding in Emacs Lisp
Date: Wed, 17 Jun 2015 08:23:27 +0200
User-agent: Mozilla/5.0 (X11; Linux i686; rv:31.0) Gecko/20100101 Thunderbird/31.4.0


Am 17.06.2015 um 02:06 schrieb Emanuel Berg:
Jim Diamond <Jim.Diamond@deletethis.AcadiaU.ca>
writes:

Really? Are there well-agreed-upon studies showing
those things? Or are they your opinion?

It strikes me that lexical scoping is easier to
implement for compiled languages (that is an "off
the cuff" comment from someone (me) with basic
knowledge of compiler construction). But if lexical
scoping is "more natural", is that because more
people were "brought up" with lexically-scoped
languages than dynamically-scoped languages?
This discussion is much easier to have if that
confusing terminology is dropped for a second and we
instead study the simple example of a `let' form:

     (let ((scratch-buffer "*scratch*"))
       (when (bufferp scratch-buffer)
         (kill-buffer scratch-buffer) ))

Here we have one piece of data which is used twice, so
that data is named and when it is used it is
indirectly refered to.

In this example, what is natural to me? Answer:
I don't expect `let' to affect any other code than the
code in the `let' itself! And this is "lexical
scoping".

Nonetheless, that's the way Emacs acted all the time, while called "dynamically" scoped.

Now with "lexical" we have instead an injection, if a function with same arguments' symbol is called inside let.

Seems neither "lexical" nor "dynamic" express the real thing.






reply via email to

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