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.
5353
5454 3. Splices inside splices (but no intervening quotes) are not allowed.
5555
56- 4. A macro method is effectively final and it may override no other method.
5756
5857# # API
5958
@@ -81,16 +80,16 @@ either show the code or run it respectivelly.
8180// make available the necessary toolbox for runtime code generation
8281implicit val toolbox: scala.quoted.Toolbox = scala.quoted.Toolbox.make(getClass.getClassLoader)
8382
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)}}
8584
86- println(sum_s .show)
85+ println(stagedSum .show)
8786
88- sum_s .run.apply(Array(1, 2, 3)) // Returns 6
87+ stagedSum .run.apply(Array(1, 2, 3)) // Returns 6
8988` ` `
9089
9190Note that if we need to run the main (in an object called `Test`) after
9291compilation we need make available the compiler to the runtime :
9392
9493` ` ` shell
9594sbt:dotty> dotr -classpath out -with-compiler Test
96- ` ` `
95+ ` ` `
You can’t perform that action at this time.
0 commit comments