Skip to content

Commit 8904601

Browse files
committed
fixes requested by @denesh
1 parent 43f0fc0 commit 8904601

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

overviews/quasiquotes/definition-details.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ The template consists of:
7878
scala> val q"new { ..$earlydefns } with RequiresX" = withx
7979
earlydefns: List[universe.Tree] = List(val x = 1)
8080

81-
2. List of parents. A list of type identifiers with optional arguments to the first one in the list:
81+
2. List of parents. A list of type identifiers where only the first one in the list may have optional type and value arguments. This is because the first parent must be a class and subsequent parents are just traits that don't yet accept arguments:
8282

8383
scala> val q"new ..$parents" = q"new Foo(1) with Bar[T]"
8484
parents: List[universe.Tree] = List(Foo(1), Bar[T])

overviews/quasiquotes/expression-details.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -557,7 +557,7 @@ While and do-while loops are low-level control structures that can be used when
557557

558558
## For and For-Yield Loops
559559

560-
For and For-Yield expressions allow us to write a monadic style comprehension that desugar into calls to `map`, `flatMap`, `foreach` and `withFilter` methods:
560+
`for` and `for-yield` expressions allow us to write a monadic style comprehension that desugar into calls to `map`, `flatMap`, `foreach` and `withFilter` methods:
561561

562562
scala> val `for-yield` = q"for (x <- xs; if x > 0; y = x * 2) yield x"
563563
for-yield: universe.Tree =
@@ -582,7 +582,7 @@ Similarly one can deconstruct the `for-yield` back into a list of enumerators an
582582
enums: List[universe.Tree] = List(`<-`((x @ _), xs), `if`(x.$greater(0)), (y @ _) = x.$times(2))
583583
body: universe.Tree = x
584584

585-
It's important to mention that For and For-Yield do not cross-match each other:
585+
It's important to mention that `for` and `for-yield` do not cross-match each other:
586586

587587
scala> val q"for (..$enums) $body" = `for-yield`
588588
scala.MatchError: ...

overviews/quasiquotes/hygiene.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ outof: 13
1212

1313
The notion of hygiene has been widely popularized by macro research in Scheme. A code generator is called hygienic if it ensures the absence of name clashes between regular and generated code, preventing accidental capture of identifiers. As numerous experience reports show, hygiene is of great importance to code generation, because name binding problems are often non-obvious and lack of hygiene might manifest itself in subtle ways.
1414

15-
Sophisticated macro systems such as Racket's have mechanisms that make macros hygienic without any effort from macro writers. In Scala we don't have automatic hygiene yet - both of our codegen facilities (compile-time codegen with macros and runtime codegen with toolboxes) require programmers to handle hygiene manually. Fixing this is our number one priority for 2.12 (see [future prospects](/overviews/quasiquotes/future.html)) but, in the meantime, you must know how to work around the absence of hygiene, which is what this section is about.
15+
Sophisticated macro systems such as Racket's have mechanisms that make macros hygienic without any effort from macro writers. In Scala we don't have automatic hygiene - both of our codegen facilities (compile-time codegen with macros and runtime codegen with toolboxes) require programmers to handle hygiene manually. You must know how to work around the absence of hygiene, which is what this section is about.
1616

1717
Preventing name clashes between regular and generated code means two things. First, we must ensure that, regardless of the context in which we put generated code, its meaning will not change (*referential transparency*). Second, we must make certain that regardless of the context in which we splice regular code, its meaning will not change (often called *hygiene in the narrow sense*). Let's see what can be done to this end on a series of examples.
1818

0 commit comments

Comments
 (0)