The key insight behind set of scopes is just... Wow. It's like a piñata for name lookup.
Instead of thinking in strings/renaming/source ranges/what have you, you approach the problem in a more systematic way and boom, so many nice things fall out.
Conversation
I wonder if, using this idea, you can make a ✨name resolution library✨ (especially for host languages without fancy macros). You create bindings and scopes using certain APIs and you get (multi-threaded? cached?) name resolution "for free", including in the presence of macros.
2
1
Replying to
Do you have a way of describing 'sets of scopes' in a succinct way? At the moment I'm using normalization-by-evaluation, and using a combination of de bruijn indices and levels for performance reasons, but wish I had a way of doing it that was less... positional?
Replying to
I'm referring to Matthew Flatt's paper "Binding as Sets of Scopes".
cs.utah.edu/plt/scope-sets/
AIUI NBE and De Bruijn indices are techniques for faster type-checking, set of scopes is more about correctness of scoping behavior in presence of complex scoping rules.
3
3
I've been re-reading the paper after having bounced off of it earlier; happy to discuss more via DM if you're interested. 😄
1

