Mercerenies / gdlisp

Lisp on the Godot platform
GNU General Public License v3.0
141 stars 1 forks source link

macrolet #19

Closed Mercerenies closed 3 years ago

Mercerenies commented 3 years ago

macrolet (and its more esoteric cousin symbol-macrolet) is useful, as it allows macros to generate code which provides local access to macros. It's basically flet but for macros.

Common Lisp says that it's unspecified what happens if a macrolet macro uses a closure variable. If we implement macrolet, we'll definitely make this an error; local macros cannot use closures. Period.

If we end up implementing macrolet, I may open a separate issue for discussing symbol-macrolet.

Mercerenies commented 3 years ago

e4b47cf implements this feature. We'll use issue #22 for tracking symbol-macrolet.

Additionally, implementing macrolet has uncovered some awkward scoping issues with flet and labels. The former was an easy fix, but labels is more complex, as always, so #21 has been opened tracking this issue.