File tree Expand file tree Collapse file tree 1 file changed +13
-0
lines changed
docs/docs/reference/metaprogramming Expand file tree Collapse file tree 1 file changed +13
-0
lines changed Original file line number Diff line number Diff line change @@ -598,6 +598,19 @@ def defaultOfImpl(str: String): Expr[Any] = str match {
598
598
// in a separate file
599
599
val a : Int = defaultOf(" int" )
600
600
val b : String = defaultOf(" string" )
601
+
601
602
```
602
603
604
+ ### Defining a macro and using it in a single project
605
+ It is possible to define macros and use them in the same project as the implementation of
606
+ the macros does not depend on code in the file where it used. It might still depend
607
+ on types and quoted code that refers to the use-site file.
608
+
609
+ To provide this functionality Dotty provides a transparent compilation mode were files that
610
+ expand try to expand a macro but fail because the macro has not been compiled yet are suspended.
611
+ If there are any suspended files when the compilation ends, the compiler will automatically restart
612
+ compilation of the suspended files using the output of the previous (partial) compilation as macro classpath.
613
+ In case all files are suspended due to cyclic dependencies the compilation will fail with an error.
614
+
615
+
603
616
[ More details] ( ./macros-spec.md )
You can’t perform that action at this time.
0 commit comments