Skip to content

Conversation

@lrytz
Copy link
Member

@lrytz lrytz commented May 28, 2019

The selection of methods available on Option is not very consistent.
For example, there is .toList, but not .to or any of the other
standard conversion methods like .toVector, .toSet, etc. There are
likely other methods that are commonly used today, but only available
through option2Iterable (e.g., mkString).

It's too late for 2.13 to go over Option's API. Keeping
option2Iterable covers up some of the shortcomings, and it's the same
as in 2.12, therefore backwards compatible.

The selection of methods available on `Option` is not very consistent.
For example, there is `.toList`, but not `.to` or any of the other
standard conversion methods like `.toVector`, `.toSet`, etc. There are
likely other methods that are commonly used today, but only available
through `option2Iterable` (e.g., `mkString`).

It's too late for 2.13 to go over Option's API. Keeping
`option2Iterable` covers up some of the shortcomings, and it's the same
as in 2.12, therefore backwards compatible.
@scala-jenkins scala-jenkins added this to the 2.13.1 milestone May 28, 2019
@lrytz lrytz modified the milestones: 2.13.1, 2.13.0-RC3 May 28, 2019
@diesalbla diesalbla added the library:collections PRs involving changes to the standard collection library label May 28, 2019
@adriaanm
Copy link
Contributor

What's the worst that can happen in pretending Option is a full collection? Is avoiding that "worst" worth annoying users who just want to do a mkString or, god forbid, _.take(2), or some other method we forgot to add? We can deprecate in 2.14 if there's a truly compelling case against, but I haven't seen it yet.

@adriaanm
Copy link
Contributor

(Yes, I know I initially suggested the deprecation as a compromise -- in a perfect world, I would prefer keeping it, but I no longer think it's compelling enough.)

@lrytz
Copy link
Member Author

lrytz commented May 28, 2019

I would still deprecate the conversion at some point, but after making sure that commonly used methods exist on Option, and converting to anything else than .iterator or .toList is easy - which currently is not the case.

@adriaanm adriaanm merged commit b813945 into scala:2.13.x May 28, 2019
@SethTisue SethTisue added the release-notes worth highlighting in next release notes label May 30, 2019
@SethTisue SethTisue changed the title Un-deprecate option2Iterable Un-deprecate option2Iterable implicit conversion May 30, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

library:collections PRs involving changes to the standard collection library release-notes worth highlighting in next release notes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants