Skip to content

Latest commit

 

History

History
19 lines (15 loc) · 1005 Bytes

README.md

File metadata and controls

19 lines (15 loc) · 1005 Bytes

Experiments with macros in scala 3

Current macro is a POC that collects instances of a specific type (in current implementation Strings) into a list, given an application built with traits containing those instances.

Helpful resources for learning scala 3 macros:

TODOs:

  • Find a way to force a user to always use a macro method instead of building a list manually. Maybe through some implicit (given). As far as I can see that's not possible at the moment, because macro cannot mutate context AST, like adding some given instances to an application passed as a parameter to a macro. Maybe it will be possible in the future, say through an explicit tree typechecking. 🤷‍
  • Examine self type annotation to determine which traits should be considered for search for a specific type instances also consider using an inheritance instead.
  • Use some real-world examples