-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Try to drop symbol literals #7499
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
Conversation
|
refs:#7395 |
a9d0fb6 to
fff2077
Compare
95f2c61 to
964b203
Compare
964b203 to
2d495c3
Compare
| val q"${s: scala.Symbol}" = q"'foo" | ||
| assert(s.isInstanceOf[scala.Symbol] && s == 'foo) | ||
| val q"${s: scala.Symbol}" = q"""sym"foo"""" | ||
| assert(s.isInstanceOf[scala.Symbol] && s == sym"foo") |
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.
There's no way to make this reflection test of symbols to work:
! unliftable.unlift scala.symbol: Exception raised on property evaluation.
> Exception: scala.MatchError: StringContext("foo").sym() (of class scala.reflect.internal.Trees$Apply)
scala.reflect.quasiquotes.UnliftableProps$.$anonfun$new$26(UnliftableProps.scala:76)
Probably not a big loss?
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.
Actually, it looks like this is how utest implements symbol-based test names:
Fortunately, utest already supports a string-based alternative.
|
I'd say this experiment went well. Should this PR saty open? |
|
I was going to continue the experiment by having it run in the community build, scala/community-build#824, but I was waiting for Seth to get back from vacation. However, I predict this will need to be backported to a 2.12 branch to get any real feedback from community build, though, since the 2.13 community build isn't very far along, yet. |
This is a demonstration of dropping symbol literals to answer at least two questions:
For (2), this experiment is based upon the new
symsyntax feature branch in the pull request #7495.Proposal to deprecate symbol literals is scala/scala-dev#459.