Looking for programming language development advice, Kittyscript, a little bit o...
Luna Dragofelis ΘΔ🏳️⚧️🐱& @LunaDragofelis@void.lgbt
Content warning: Looking for programming language development advice, Kittyscript, a little bit of Lisp pseudocode
I'm currently again thinking about the #Kittyscript compiler, specifically about compile time side effects.
What should happen if a nested function contains a call to an identifier that is a macro in top level scope, but in a scope between that call and the top level, but *behind* the aforementioned nested function in the AST, the same identifier is defined differently to shadow the top-level macro.
Example in Lisp-style syntax:
(defmacro foo whatever)
(defn outer ()
(defn inner ()
(foo)
)
(defmacro foo something-else)
)
When should (foo) be expanded? On first pass? If on first pass, should it be recompiled once the shadowing foo is hit? Or should macro expansion be deferred until after we have gone through the code once and know which definition applies? What if foo expands to further definitions, possibly to macros or other compile-time side-effected code like eval-when? How to undo those?
#programming #PLDev #LangDev
What should happen if a nested function contains a call to an identifier that is a macro in top level scope, but in a scope between that call and the top level, but *behind* the aforementioned nested function in the AST, the same identifier is defined differently to shadow the top-level macro.
Example in Lisp-style syntax:
(defmacro foo whatever)
(defn outer ()
(defn inner ()
(foo)
)
(defmacro foo something-else)
)
When should (foo) be expanded? On first pass? If on first pass, should it be recompiled once the shadowing foo is hit? Or should macro expansion be deferred until after we have gone through the code once and know which definition applies? What if foo expands to further definitions, possibly to macros or other compile-time side-effected code like eval-when? How to undo those?
#programming #PLDev #LangDev