File tree Expand file tree Collapse file tree 1 file changed +4
-5
lines changed
docs/docs/reference/metaprogramming Expand file tree Collapse file tree 1 file changed +4
-5
lines changed Original file line number Diff line number Diff line change @@ -53,7 +53,6 @@ impose the following restrictions on the use of splices.
53
53
54
54
3. Splices inside splices (but no intervening quotes) are not allowed.
55
55
56
- 4. A macro method is effectively final and it may override no other method.
57
56
58
57
# # API
59
58
@@ -81,16 +80,16 @@ either show the code or run it respectivelly.
81
80
// make available the necessary toolbox for runtime code generation
82
81
implicit val toolbox: scala.quoted.Toolbox = scala.quoted.Toolbox.make(getClass.getClassLoader)
83
82
84
- val sum_s : Expr[Array[Int] => Int] = '{ (arr: Array[Int]) => ${sum('arr)}}
83
+ val stagedSum : Expr[Array[Int] => Int] = '{ (arr: Array[Int]) => ${sum('arr)}}
85
84
86
- println(sum_s .show)
85
+ println(stagedSum .show)
87
86
88
- sum_s .run.apply(Array(1, 2, 3)) // Returns 6
87
+ stagedSum .run.apply(Array(1, 2, 3)) // Returns 6
89
88
` ` `
90
89
91
90
Note that if we need to run the main (in an object called `Test`) after
92
91
compilation we need make available the compiler to the runtime :
93
92
94
93
` ` ` shell
95
94
sbt:dotty> dotr -classpath out -with-compiler Test
96
- ` ` `
95
+ ` ` `
You can’t perform that action at this time.
0 commit comments