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: Emanuel Berg
Subject: Re: Real-life examples of lexical binding in Emacs Lisp
Date: Wed, 17 Jun 2015 02:06:42 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.4 (gnu/linux)

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".

Is it really so, that you expect it to be in another
way? If so - OK. I don't think most people feel like
that and I certainly don't, because I don't program
that way and the impression is made even stronger with
the LISP syntax of enclosed lists.

-- 
underground experts united
http://user.it.uu.se/~embe8573


reply via email to

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