Symmetric Support for Lexical and Dynamic Scope (Binding) in ISLisp.
In ISLisp, all combinations of global/local and lexical/dynamic
operators for definition of variables are supported.
If operator contains word "dynamic", then the binding will be dynamic.
The operator 'dynamic' is needed for reference of such variables.
Hence, ISLisp is only dialect of Lisp that allows all versions of
standard example for explanation of difference between lexical
and dynamic scope.
global binding of x in place of function definition | lexical | dynamic ------------+ ----------+----------- local binding of lexical | 1 | 1 x in place of ------------+-----------+----------- function call dynamic | 1 | 2 ------------+-----------+-----------Here is the code: ;----------------- (defglobal x 1) (defun f()x) (let((x 2)) (print (f))) ;=>1 ;----------------- (defglobal x 1) (defun f()x) (dynamic-let((x 2)) (print (f))) ;=>1 ;----------------- (defdynamic x 1) (defun f()(dynamic x)) (let((x 2)) (print (f))) ;=>1 ;----------------- (defdynamic x 1) (defun f()(dynamic x)) (dynamic-let((x 2)) (print (f))) ;=>2 ;-----------------ISLisp is simplified and on few places, like this one, improved Common Lisp. I must recommend the most mature implementation of ISLisp: Christian Jullien's Eligis OpenLisp, commercial compiler which supports more than 90 architectures, from 16-bit MSDOS to IBM mainframe; there is also an interpreter, free for personal use, and so well implemented that on my EVAL test it is second only to in assembly language written Picolisp, so OpenLisp can be attractive to those who like both lexical scope and dynamic scope and eval. Support is excellent. Check it. It definitely deserves more attention. |
--
No comments:
Post a Comment