Re:History of T (2001)
by nils-m-holm on Saturday August 18, 2018 @07:06AM
(#17787949)
And even in the LISPs that did give up dynamic binding, you can still emulate it to some degree. E.g. in Scheme:
(define-syntax fluid-let
(syntax-rules ()
((_ () x . xs)
(begin x . xs))
((_ ((v1 a1) (v2 a2) ...) x . xs)
(let ((tmp v1))
(set! v1 a1)
(fluid-let ((v2 a2) ...)
(let ((r (begin x . xs)))
(set! v1 tmp)
r))))))
(define x 'foo)
(define (f) x)
(f) ==> foo
(fluid-let ((x 'bar))
(f)) ==> bar
See: The Funarg problem, 1968 http://www.softwarepreservation.org/projects/LISP/MIT/Weizen...
Mid 70s Scheme then was the first dialect to use lexical binding as a default. From then on new dialects of Lisp or new versions of of it switched over time to lexical binding by default. Scheme names block-structured Algol as one of its influences. 1982 Common Lisp was initially described amd it was then also using lexical binding.
The primitive block structured languages like PASCAL had it from Algol, too. But it was not a big deal, because they had no Closures, were not using Interpreters, had first class functions, no higher-order functions, etc. Lisp users were looking to implement higher-order functions in a 'right' way.
But most Lisps never gave up to provide dynamic binding as a feature, since it is used in a lot of programs...