You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/macros.md
+43-1Lines changed: 43 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -9,13 +9,55 @@ Scala 3 will break this limitation but it comes with the cost of rewriting all t
9
9
While being experimental, the Scala community has largely adopted the Scala 2 [Def Macro](https://docs.scala-lang.org/overviews/macros/overview.html) feature in multiple of ways: code generation, optimizations, ergonomic DSLs...
10
10
11
11
Here is an incomplete list of libraries that use Scala 2 macros and their migration status:
12
+
12
13
[Contributors welcome!](CONTRIBUTING.md)
13
14
14
15
## How to?
15
16
17
+
### Before rewriting a macro
18
+
19
+
Before getting deep into reimplementing a macro your should check if it can be supported using Scala 3 new features.
20
+
21
+
* Can I encode the logic of the macro using the new scala 3 features?
22
+
*[List of Scala 3 features](http://dotty.epfl.ch/docs/reference/overview.html)
23
+
* Can I use *match types* to reimplement the interface of my macro?
A good reference for this is [Shapeless 3](https://github.com/dotty-staging/shapeless/tree/shapeless-3). It uses Scala 3 features most of the time for a feature that would have been macros in Scala 2 and only uses macros where absolutely necessary.
35
+
36
+
### Defining a project that cross compiles macros
37
+
38
+
If you are already cross-compiling your macro for different versions of Scala 2 and you have sources folders for each version, then you can add an extra source folder for Scala 3.
0 commit comments