-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Remove quoted.matching.Sym #8486
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
Remove quoted.matching.Sym #8486
Conversation
@@ -14,22 +14,22 @@ object Test { | |||
case '{ 1 + ($y: Int)} => y | |||
case '{ val a = 1 + ($y: Int); 3 } => y | |||
case '{ val $y: Int = $z; println(`$y`); 1 } => | |||
val a: quoted.matching.Sym[Int] = y | |||
val a: String = y |
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.
If y
is String, the semantics for the reference to y
in println($y)
becomes problematic.
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.
Why? Could you elaborate
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.
After discussion, now I see the $y
in val $y = e
has double meaning.
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.
In general, a $
can be in an expression position (Expr[T]
), type position (Type[T]
) or definition position (String
)
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.
LGTM
@@ -14,22 +14,22 @@ object Test { | |||
case '{ 1 + ($y: Int)} => y | |||
case '{ val a = 1 + ($y: Int); 3 } => y | |||
case '{ val $y: Int = $z; println(`$y`); 1 } => | |||
val a: quoted.matching.Sym[Int] = y | |||
val a: String = y |
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.
After discussion, now I see the $y
in val $y = e
has double meaning.
Since quoted patterns do not return open quotes, this abstraction does not have any purpose. The only useful part of it is extracting the name of a binding, therefore instead of returning a Sym we return the name as a String directly.
27c00df
to
721223f
Compare
Rebased |
Since quoted patterns do not return open quotes, this abstraction does not have any purpose.
The only useful part of it is extracting the name of a binding, therefore instead of returning a Sym we return the name as a String directly.