Are you an EPFL student looking for a semester project?
Work with us on data science and visualisation projects, and deploy your project as an app on top of Graph Search.
Macro annotations are an important feature in Scala 2 macro system. Many projects use macro annotations to implement their systems or libraries. Due to the unportability of Scala 2 macro system, Scala 3 redesigns the macro system to make it more reliable and portable. But macro annotations have not been implemented in Scala 3 yet, resulting in some inconvenience in migrating projects that use macro annotations to Scala 3. Following the core design of Scala 2 macro annotations, we introduce the macro annotations as transformations from definitions to definitions. In this thesis, we also list rules to keep our simplicity but not hurt its functionality at the same time. The main difference between macro annotations of Scala 2 and Scala 3 is that in Scala 2 macro annotations expand before typechecking, while they expand after typechecking in Scala 3. Our implementation is based on a breadth-first approach, which helps us implement a tail-recursive transformation. We write test cases covering common and even uncommon cases to test the correctness of our macro annotation system.
Martin Odersky, Nicolas Alexander Stucki, Jonathan Immanuel Brachthäuser