Skip to content

Update quotes.md #2047

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jun 14, 2021
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions _overviews/scala3-macros/tutorial/quotes.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Intuitively, the code directly within the quote is not executed now, while the c

```scala
val msg = Expr("Hello")
val printHello = '{ print($hello) }
val printHello = '{ print($msg) }
println(printHello.show) // print("Hello")
```

Expand Down Expand Up @@ -45,8 +45,8 @@ def myBadCounter2(using Quotes): Expr[Int] = '{
${ x += 1; 'x }
}
```
Clearly, this should work as the variable does not exist yet.
To make sure you can only write programs that do not contain these kinds of problems we restrict the set of references to variable and other definitions.
Clearly, this should not work as the variable does not exist yet.
To make sure you cannot write programs that contain these kinds of problems, we restrict the set of references to variable and other definitions.

We introduce _levels_ as a count of the number of quotes minus the number of splices surrounding an expression or definition.

Expand Down