Skip to content

One does not simply walk into Mordor #2046

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 1 commit into from
May 24, 2021
Merged
Changes from all commits
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
4 changes: 2 additions & 2 deletions _overviews/scala3-macros/tutorial/quotes.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ Due to some technical considerations we only allow it directly within `inline` d
It is possible to write a quote within a quote, but usually when we write macros we do not encounter such code.

## Level consistency
One cannot simple write any arbitrary code within quotes and within splices.
One cannot simply write any arbitrary code within quotes and within splices.
A part of the program will live at compile-time and the other will live at runtime.
Consider the following ill-constructed code.

Expand All @@ -45,7 +45,7 @@ def myBadCounter2(using Quotes): Expr[Int] = '{
${ x += 1; 'x }
}
```
Clearly, this should work as the variable does not exist yet.
Clearly, this should not 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.

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