Skip to content
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

any2stringadd now has an evil twin #8229

Closed
scabug opened this issue Feb 2, 2014 · 4 comments
Closed

any2stringadd now has an evil twin #8229

scabug opened this issue Feb 2, 2014 · 4 comments
Assignees
Milestone

Comments

@scabug
Copy link

scabug commented Feb 2, 2014

It's well known that the following idiom should disable String-+:

import Predef.{any2stringadd => _, _}

object Test {
  new Object() +"abc"
}

Only, it doesn't anymore. You need to write:

import Predef.{any2stringadd => _, StringAdd => _, _}

object Test {
  new Object() +"abc"
}

The problem is that any2stringadd has spawned an evil twin in the form of the class StringAdd which is now an implicit class. I am not sure why StringAdd has to be an implicit class in the first place.

@scabug
Copy link
Author

scabug commented Feb 2, 2014

Imported From: https://issues.scala-lang.org/browse/SI-8229?orig=1
Reporter: @odersky
Affected Versions: 2.11.0-M7

@scabug
Copy link
Author

scabug commented Feb 2, 2014

@retronym said (edited on Feb 2, 2014 4:35:37 PM UTC):
any2stringadd is deprecated and now non-implicit. But for source compatibility with the shadowing trick, we can revert that.

@scabug
Copy link
Author

scabug commented Feb 2, 2014

@odersky said:
I did not realize that any2stringadd was now non-implicit. But yes, since it is part of an important idiom we should keep the name of the implicit stable.

@scabug
Copy link
Author

scabug commented Feb 18, 2014

@retronym said (edited by @adriaanm on Feb 18, 2014 11:42:27 PM UTC):
scala/scala#3555

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants