Skip to content

Commit 833775f

Browse files
committed
Address review comments on reference section
1 parent 8656be3 commit 833775f

File tree

1 file changed

+15
-15
lines changed

1 file changed

+15
-15
lines changed

docs/docs/reference/symmetric-meta-programming.md

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Symmetric Meta Programming
22

33
Symmetric meta programming is a new framework for staging and for some
4-
forms of macros. It is is expressed as strongly and statically typed
4+
forms of macros. It is expressed as strongly and statically typed
55
code using two fundamental operations: quotations and splicing. A
66
novel aspect of the approach is that these two operations are
77
regulated by a phase consistency principle that treats quotes and
@@ -90,7 +90,7 @@ allowed everywhere.
9090
The phase consistency principle can be motivated as follows: First,
9191
suppose the result of a program `P` is some quoted text `’{ ... x
9292
... }` that refers to a free variable `x` in `P` This can be
93-
represented only by referring to original the variable `x`. Hence, the
93+
represented only by referring to the original variable `x`. Hence, the
9494
result of the program will need to persist the program state itself as
9595
one of its parts. We don’t want to do this, hence this situation
9696
should be made illegal. Dually, suppose a top-level part of a program
@@ -180,7 +180,7 @@ Here’s the definition of the `mapImpl` macro, which takes quoted types and exp
180180

181181
object Macros {
182182

183-
def mapImpl[T, U](u: Type[U], arr: Expr[Array[T]], op: Expr[T => U])(implicit ctx: Context): Expr[Array[U]] = ’{
183+
def mapImpl[T, U](u: Type[U], arr: Expr[Array[T]], op: Expr[T => U]): Expr[Array[U]] = ’{
184184
var i = 0
185185
val xs = ~arr
186186
var len = xs.length
@@ -314,7 +314,7 @@ tweak of the typing rules. An inline function such as `assert` that
314314
contains a splice operation outside an enclosing quote is called a
315315
_macro_. Macros are supposed to be expanded in a subsequent phase,
316316
i.e. in a quoted context. Therefore, they are also type checked as if
317-
they were in a quoted context, For instance, the definition of
317+
they were in a quoted context. For instance, the definition of
318318
`assert` is typechecked as if it appeared inside quotes. This makes
319319
the call from `assert` to `assertImpl` phase-correct, even if we
320320
assume that both definitions are local.
@@ -631,9 +631,9 @@ We define a small step reduction relation `-->` with the following rules:
631631

632632
~(’t) --> t
633633

634-
t --> t’
635-
----------------
636-
e[t] --> e[t’]
634+
t1 --> t2
635+
-----------------
636+
e[t1] --> e[t2]
637637

638638
The first rule is standard call-by-value beta-reduction. The second
639639
rule says that splice and quotes cancel each other out. The third rule
@@ -668,14 +668,14 @@ environment of the stack.
668668
Es * E |- x: T
669669

670670

671-
Es * E, x: T |- t: T’
672-
------------------------------
673-
Es * E |- (x: T) => t: T -> T’
671+
Es * E, x: T1 |- t: T2
672+
-------------------------------
673+
Es * E |- (x: T1) => t: T -> T2
674674

675675

676-
Es |- t: T’ -> T Es |- t’: T’
677-
--------------------------------
678-
Es |- t t’: T
676+
Es |- t1: T2 -> T Es |- t2: T2
677+
---------------------------------
678+
Es |- t1 t2: T
679679

680680
The rules for quotes and splices map between `expr T` and `T` by trading `` and `~` between
681681
environments and terms.
@@ -743,7 +743,7 @@ constructor could be typed as follows:
743743

744744
This would allow constructing applications from lists of arguments
745745
without having to match the arguments one-by-one with the
746-
corresponding formal parameter types of the function. We need then "at
746+
corresponding formal parameter types of the function. We then need "at
747747
the end" a method to convert an `Expr[_]` to an `Expr[T]` where `T` is
748748
given from the outside. E.g. if `code` yields a `Expr[_]`, then
749749
`code.atType[T]` yields an `Expr[T]`. The `atType` method has to be
@@ -757,7 +757,7 @@ to be type correct loses a lot of guidance for constructing the right
757757
trees. So we should wait with this addition until we have more
758758
use-cases that help us decide whether the loss in type-safety is worth
759759
the gain in flexibility. In this context, it seems that deconstructing types is
760-
less error-prone than deconstructing tersm, so one might also
760+
less error-prone than deconstructing terms, so one might also
761761
envisage a solution that allows the former but not the latter.
762762

763763
## Conclusion

0 commit comments

Comments
 (0)