@@ -8,25 +8,25 @@ multi-staging programming. We can think of compile-time meta-programming as a
88two stage compilation process: one that we write the code in top-level splices,
99that will be used for code generation (macros) and one that will perform all
1010necessecary evaluations at compile-time and an object program that we will run
11- as usual. What if we could synthesize code at runtime and offer one extra stage
12- to the programmer? Then we can have a value of type ` Expr[T] ` at runtime that we
11+ as usual. What if we could synthesize code at run-time and offer one extra stage
12+ to the programmer? Then we can have a value of type ` Expr[T] ` at run-time that we
1313can essentially treat as a typed-syntax tree that we can either _ show_ as a
1414string (pretty-print) or compile and run. If the number of quotes exceeds the
15- number of splices more than one (effectively handling at run-time values of type
16- ` Expr[Expr[T]] ` , ` Expr[Expr[Expr[T]]] ` , ... we talk about Multi-Stage
17- Programming) .
15+ number of splices by more than one (effectively handling at run-time values of type
16+ ` Expr[Expr[T]] ` , ` Expr[Expr[Expr[T]]] ` , ...) then we talk about Multi-Stage
17+ Programming.
1818
1919The motivation behind this _ paradigm_ is to let runtime information affect or
2020guide code-generation.
2121
2222Intuition: The phase in which code is run is determined by the difference
2323between the number of splice scopes and quote scopes in which it is embedded.
2424
25- - If there are more splices than quotes, the code is run at " compile-time" i.e.
25+ - If there are more splices than quotes, the code is run at compile-time i.e.
2626 as a macro. In the general case, this means running an interpreter that
2727 evaluates the code, which is represented as a typed abstract syntax tree. The
2828 interpreter can fall back to reflective calls when evaluating an application
29- of a previously compiled method. If the splice excess is more than one, it
29+ of a previously compiled method. If the splice excess is more than one, it
3030 would mean that a macro’s implementation code (as opposed to the code it
3131 expands to) invokes other macros. If macros are realized by interpretation,
3232 this would lead to towers of interpreters, where the first interpreter would
@@ -61,7 +61,7 @@ to be executed at a later stage. To run that code, there is another method
6161in class ` Expr ` called ` run ` . Note that ` $ ` and ` run ` both map from ` Expr[T] `
6262to ` T ` but only ` $ ` is subject to the PCP, whereas ` run ` is just a normal method.
6363Run provides a ` QuoteContext ` that can be used to show the expression in the scope of ` run ` .
64- On the other hand ` withQuoteContext ` provides a ` QuoteContext ` without evauating the expression.
64+ On the other hand ` withQuoteContext ` provides a ` QuoteContext ` without evaluating the expression.
6565
6666``` scala
6767package scala .quoted .staging
0 commit comments