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
Deprecate nonsensical StringOps operations #6702
Conversation
@@ -1287,9 +1288,11 @@ final class StringOps(private val s: String) extends AnyVal { | |||
* ''n'' times in `that`, then the first ''n'' occurrences of `x` will be retained | |||
* in the result, but any following occurrences will be omitted. | |||
*/ | |||
@deprecated("Use `new WrappedString(s).intersect(...).self` instead of `s.diff(...)`", "2.13.0") |
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.
"...instead of s.intersect(...)
"
@@ -1299,6 +1302,7 @@ final class StringOps(private val s: String) extends AnyVal { | |||
* @tparam B the type of the elements after being transformed by `f` | |||
* @return a new string consisting of all the chars of this string without duplicates. | |||
*/ | |||
@deprecated("Use `new WrappedString(s).distictBy(...).self` instead of `s.distictBy(...)`", "2.13.0") |
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.
distict
-> distinct
def combinations(n: Int): Iterator[String] = new WrappedString(s).combinations(n).map(_.self) | ||
|
||
/** Iterates over distinct permutations. | ||
* | ||
* @return An Iterator which traverses the distinct permutations of this string. | ||
* @example `"abb".permutations = Iterator(abb, bab, bba)` | ||
*/ | ||
@deprecated("Use `new WrappedString(s).permutations(...).map(_.self)` instead of `s.combinations(...)`", "2.13.0") |
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.
combinations
-> permutations
@hrhino The kind of bugs that creep in when the workday gets too long :-) |
Maybe some are useful / convenient to keep? In decreasing order of potential usefulness:
|
You can still use all of them on a |
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.
Good point about unicode.
the deprecation messages say e.g.
but EDIT: better |
|
PR to revert: #9246 |
Fixes scala/bug#10881
This goes further than just the methods that I identified in #6565 (comment) by deprecating all methods that forward to
WrappedString
. I did not implement optimized versions inStringOps
originally because these methods do not really make sense forString
. Users can always call theWrappedString
equivalents directly (if that's what they really want).