-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Add syntax for higher order quote pattern holes #8876
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
Add syntax for higher order quote pattern holes #8876
Conversation
24a4798
to
a0445e3
Compare
555010d
to
6e4ac13
Compare
As discussed offline, we will try to encode it with the syntax case ${ val a = 3; ${body}{a}: Int } => |
6e4ac13
to
229924f
Compare
Note that there is a possible improvement for multiple parameters if we allow commas in block in the parser |
* Make typer explicitly type higher-order quasiquotes * Add higher-order quasi-pattern concept to the Matcher (avoid ambiguities with splice applied to arguments) * Introduce unambiguous syntax for higher-order quasi-patterns * Add documentation * Warn if old syntax is detected
```scala case ${ val a = 3; ${body}{a}: Int } => ```
b284973
to
f6b48a5
Compare
I am still not sure about the best syntax. My original proposal was to use $body{y} for the instantiated splice, and to reserve $body{y, z}
$body{(y, z)} The first uses a comma in a block, which never happens otherwise and the second looks like But before settling on this, a question: If we leave it as $block(y) how often (relatively speaking) is this a higher-order hole? If that's the common case, can we maybe live with the fallback ${block}(y) for the uncommon case where $block is spliced in front of the literal argument list |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should have another discussion about the best syntax.
7a34f45
to
75d8ba9
Compare
315cbde
to
f03d0a3
Compare
@odersky I updated the syntax to the one we discussed in the weekly meeting. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Otherwise LGTM
Uh oh!
There was an error while loading. Please reload this page.