4 ms·
We're actively working on static metaprogramming. It got slowed down during the lead-up to 3.0 because it was sort of all-hands-on-deck to get that set of featu
by munificent 3y ago
We're actively working on static metaprogramming. It got slowed down during the lead-up to 3.0 because it was sort of all-hands-on-deck to get that set of features out and fully migrate stuff to null safety. Now that that's done, we're picking it back up.
It's a particularly hard feature to work on because it touches everything. Some of the kinds of stuff you run into are like:
* How do IDEs handle go-to-definition when the thing you're navigating to is generated through metaprogramming?
* What is the API we expose to macros and how does that API evolve when the language changes?
* If a macro adds a method to a class that shadows a top-level identifier, how does that interact with other method bodies in that class that might be referring to that identifier?
* What happens to the user experience when a macro takes a really long time to run? Can users tell which macros are running slowly? How?
* What happens when a macro throws an exception or otherwise fails?
* How does hot reload work with macros? How does macro performance affect hot reload time?
* What is the syntax for invoking a macro? What kinds of arguments can you pass to macros? Are they passed as values, raw syntax, meta-values? If they are passed as values, when are those values evaluated and in what context?
* Are macros expressive enough for the use cases we have? Are they too powerful? What kinds of things should you be able to do with macros? What kinds of things should you not be able to do?
* How does a user understand code that may be relying heavily on macros?
* What is the user experience for authoring a macro? What developer tools do we give you? What is it like maintaining a package that exposes publicly usable macros? When the language changes, what do macro package authors have to do to keep their package working?
Getting any of these answers wrong can really harm the whole user experience of the language, so it's just a big challenging ball of work with lots of stakeholders. We're making good progress and I'm really excited by everything Jake, Johnni, and Konstantin are doing, but it's definitely not something we want to rush.