scala / collection-strawman

Implementation of the new Scala 2.13 Collections
Apache License 2.0
200 stars 72 forks source link

`seq` operation has been removed #554

Closed julienrf closed 6 years ago

julienrf commented 6 years ago

It was used to convert a GenXxx into a sequential collection. New collections are only sequential, so there is no need for this method, but we should keep it and deprecate it (implementation would just return this).

julienrf commented 6 years ago

Other methods that could have the same treatment: fold, reduce and scan.

julienrf commented 6 years ago

We should also implement a rewrite rule that transforms fold calls to foldLeft, etc.

szeiger commented 6 years ago

The best return type for seq would be C or this.type, making for a very simple implementation in a single place. This doesn't cover StringOps though. "foo".seq is supposed to return a collection type (so no C because that would be String) and we don't want StringOps to leak into return types (so no this.type either).