Once a programming language exposes a Turing complete macro system, the need arises for a Smalltalk-like meta-object protocol so that nested macros can negotiate with each other and the compiler itself. This is where things get tricky.
-
-
i see. but the type system and the (classical) macro system are two different things. macros are expanded during syntax tree generation, and at that point, types are not known yet. macros can however generate template declarations and functions which cover type dependent tasks
-
Even with macros being functions from syntax to syntax, they often need to interact locally with the compiler as they're running, for example to determine the scope of a name, or the type of a declared variable. Especially in an open world context.
- 17 more replies
New conversation -
-
-
So I need to read compiler-generated metadata while recursively producing syntax that's fed into the compiler too. And other people want to create their own types, and have everything interoperate. So you need a protocol for sorting this out, and a degree of lazyness, and so on.
-
Sounds like you want multi-stage programming?
End of conversation
New conversation -
-
-
I believe this is one of the main things Hackett (Haskell-flavored Racket) is trying to address, by implementing the type system *as* macros. https://github.com/lexi-lambda/hackett/blob/master/README.md …
-
Yea, was following. It’s super interesting and based on an awesome paper I’ve read and re-read many times.
- 1 more reply
New conversation -
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.