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: Pascal J. Bourguignon
Subject: Re: Real-life examples of lexical binding in Emacs Lisp
Date: Sat, 30 May 2015 14:50:11 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux)

Rusi <rustompmody@gmail.com> writes:

> I'd say you are getting this from the wrong end.
> Today (2015) dynamic scoping is considered a bug

"Bug" is too strong a word here.


> In 1960 when Lisp was invented of course people did not realize this.
> This is just a belated bug-fix

It is actually in 1960 (or a few years after) when LISP was invented,
that people realized there was the so called "Funarg problem".  During
the 60s this problem has been studied, several (faulty) solutions
proposed, and eventually the notions of lexical binding vs. dynamic
binding and environments were elaborated.

Other languages such as Fortran and Algol had already something like
lexical binding, but it was actually as accidental as the dynamic
binding of LISP, and of no consequence, since in those languages it was
not possible to create closures anyways. 

At the end of the 60s the solution to the FUNARG problem, ie. lexical
binding and the creation of closures was finally invented, and
implemented in PAL and eventually in scheme.

http://en.wikipedia.org/wiki/Closure_%28computer_programming%29#History_and_etymology


But even in scheme, dynamic binding is useful and implemented (in
libraries).  In any lexical programming language, you can implement
dynamic binding when needed.


In conclusion, my point is that both lexical binding and dynamic binding
are useful techniques that can be used in programs, and there's no
reason to consider one or the others to be "bugs".  They are tools, and
you only have to know when to use them effectively.





J. Weisenbaum, "The FUNARG Problem Explained", MIT memorandum, 1968

J. Moses, "The Function of FUNCTION in LISP, or Why the FUNARG Problem
Should be Called the Environment Problem", AIM-199, June 1970.

-- 
__Pascal Bourguignon__                 http://www.informatimago.com/
“The factory of the future will have only two employees, a man and a
dog. The man will be there to feed the dog. The dog will be there to
keep the man from touching the equipment.” -- Carl Bass CEO Autodesk


reply via email to

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