Skip to content

Conversation

@ashawley
Copy link
Member

@ashawley ashawley commented Dec 5, 2018

This is a demonstration of dropping symbol literals to answer at least two questions:

  1. What does dropping symbol literals change or break?
  2. How does a new syntax fair in the test suite?

For (2), this experiment is based upon the new sym syntax feature branch in the pull request #7495.

Proposal to deprecate symbol literals is scala/scala-dev#459.

@scala-jenkins scala-jenkins added this to the 2.13.0-RC1 milestone Dec 5, 2018
@He-Pin
Copy link
Contributor

He-Pin commented Dec 5, 2018

refs:#7395

@ashawley ashawley force-pushed the 2.13-drop-symlit branch 2 times, most recently from 95f2c61 to 964b203 Compare December 6, 2018 14:46
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")
Copy link
Member Author

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?

Copy link
Member Author

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:

https://github.com/lihaoyi/utest/blob/v0.6.6/utest/shared/src/main/scala/utest/Tests.scala#L33-L39

Fortunately, utest already supports a string-based alternative.

@lrytz
Copy link
Member

lrytz commented Dec 13, 2018

I'd say this experiment went well. Should this PR saty open?

@ashawley
Copy link
Member Author

ashawley commented Dec 13, 2018

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.

@ashawley ashawley closed this Dec 13, 2018
@SethTisue SethTisue removed this from the 2.13.0-RC1 milestone Feb 22, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants