Are there any papers on systematically handling name resolution + macro expansion + type-checking without having it devolve into a ball of mud?
I'm looking at some Scala papers and those seem to be mostly about features/usage, not implementation challenges.
Conversation
Oh wait, I just had a brainfart moment. If your macros are typed, the type-checking and inference is kinda gonna work like normal functions. Macro expansion can be done later after type-checking is over.
1
2
(There's an implicit assumption here about all macros being typed. Untyped macros would throw a wrench into the gears, certainly.)
1
1
Have you looked much into MetaML and MetaOCaml?
1
Not sure if what you are looking for is somewhere in here, but it could well be:
1
1
I have looked at both a little bit, not in too much detail. One mismatch is staging vs macros, but I see there's a paper by Stucki et al. on a unification of the two. Literally just started looking at that one before your reply. 😅
1
IIUC, you can think of macros as 'functions that run during the compile time stage'. These can be typed or not.
1
Sure, as a 10,000 ft view that's fine. The devil is in the details. With untyped macros, if interleaving the macro expansion and type checking in a different way leads to a different result, that's a problem. (Since you're essentially doing effects without any "funnel monad".)
1
1
1
1
Replying to
I think the Racket people are good at this stuff? But I dunno 😬 - these are good questions. I think dependently typed langs 'solve' things just by reading stuff top to bottom.
Replying to
I've kinda' skimmed 'Binding as Sets of Scopes' and watched the corresponding Strange Loop presentation, I should probably read the paper thoroughly.
Also, it's not just dependently typed langs, SML and OCaml also work top-to-bottom (and I think Lisps too).

