hyrule icon indicating copy to clipboard operation
hyrule copied to clipboard

Consider adding dynamic/special variables to Hy

Open gilch opened this issue 7 years ago • 9 comments

Lisp originally used dynamic variables, instead of the lexical variables used in Python. They're still the norm in Emacs Lisp, and useful enough sometimes that they're still available optionally in Common Lisp (as "special variables"). For those of you not familiar with Elisp or Common Lisp, they're basically Clojure's thread-local vars.

I also think that a dynamic let would be much easier to implement. The dynamic version doesn't need closures, and could be compiled into a with statement. After purging the broken lexical let from Hy hylang/hy#1056, we could replace it with a dynamic one that has the same semantics as Elisp's let (or Clojure's binding form).

gilch avatar Aug 13 '16 22:08 gilch