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

Some useful Seq operations are deprecated on String #11676

Open
julienrf opened this issue Aug 13, 2019 · 2 comments

Comments

@julienrf
Copy link

commented Aug 13, 2019

A bunch of operations have been deprecated on String, although they make perfect sense there. I’m missing the reason for such deprecations. The suggestion in the deprecation message is often awkward and inefficient (eg, “Use s.toSeq.groupBy(...).view.mapValues(_.unwrap).toMap instead of s.groupBy(...)”).

I think that it should be possible to provide an efficient implementation for all these operations. The work can be done in separate PRs, though. Here is the list of operations:

  • diff
  • intersect
  • distinct
  • distinctBy
  • sorted
  • sortWith
  • sortBy
  • groupBy
  • sliding
  • combinations
  • permutations

@julienrf julienrf changed the title Seq operations are deprecated on String Some useful Seq operations are deprecated on String Aug 13, 2019

@szeiger

This comment has been minimized.

Copy link

commented Aug 13, 2019

The reason for the deprecation is that these methods don't make sense for Unicode strings in general. They could be useful for limited character sets but are almost guaranteed to lead to incorrect results when applied to arbitrary Unicode text.

@smarter

This comment has been minimized.

Copy link

commented Aug 13, 2019

But this is also true of existing methods on String like length or substring

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.