|
|
|
|
|
by catnaroek
3498 days ago
|
|
The “conventional” representation of syntax using explicitly named variables is utterly inconvenient and error-prone for anything other than parsing. The very first thing I want to do after parsing is convert the syntax tree to de Bruijn indices/levels or HOAS. |
|
How the heck do you handle hierarchical run-time environments in these representations? Especially mutable ones? If we have this:
These lambdas capture different, overlapping environments which share the (a b c) bindings. If there is an inner loop which repeatedly instantiates the (d e f), then new closures are made with different instances of these variables: yet those closures all share the same (a b c) bindings.So we can't just flatten the entire lexical scope to some HOAS terms and pretend that its hierarchical structure doesn't exist.