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

Deprecate Stream #9872

Closed
scabug opened this issue Jul 26, 2016 · 6 comments
Closed

Deprecate Stream #9872

scabug opened this issue Jul 26, 2016 · 6 comments
Milestone

Comments

@scabug
Copy link

scabug commented Jul 26, 2016

I believe we should deprecate in 2.13 scala.collection.immutable.Stream. There are two reasons:

  1. The current definition of Stream is awkward in that it is strict in its head. User code
    is cleaner and with fewer surprises if Stream is lazy in head and tail.

  2. The term "Stream" is misleading in that it suggests some similarity with Java streams.

I would propose to add in 2.13 a new type LazyList that can be used as a replacement for Stream but that is lazy in head and tail.

@scabug
Copy link
Author

scabug commented Jul 26, 2016

Imported From: https://issues.scala-lang.org/browse/SI-9872?orig=1
Reporter: @odersky

@scabug
Copy link
Author

scabug commented Jul 27, 2016

@soc said:
Last proposal and discussion: https://groups.google.com/d/topic/scala-internals/3pIe7Uxqwyo/discussion

@scabug
Copy link
Author

scabug commented Jul 27, 2016

@ijuma said:
Yes, this would be good. One thing to consider is what to do about methods in TraversableOnce that call toStream (e.g. toIterable, toSeq). The latter, in particular, is quite surprising and I have found several instances in production code where people ended up using Stream when calling Iterator.toSeq even though they expected to get a List or Vector (i.e. they wanted to "materialise" the Iterator, but instead got a lazy collection that could potentially be affected by changes in the underlying collection if forcing happened later).

@scabug
Copy link
Author

scabug commented Jul 27, 2016

@soc said:
Would have been nice if this had happened for 2.12, as it would take a few years off the table until we can repurpose Stream.

@scabug
Copy link
Author

scabug commented Aug 8, 2016

@SethTisue said:
I support the deprecation, and I think LazyList is the right name. It emphasizes the similarity with List (it's a cons list, but with a difference). And "LazyList" isn't short and catchy like "stream", but in the context of the other Scala collections, this is a highly unusual collection type, so flagging the unusualness in the name seems appropriate to me.

Someone proposed "MemoizingList", but I think that in Scala context, "Lazy" already sufficiently communicates that.

We'll probably want to avoid repurposing the name "Stream" at all, since the word is now so heavily overloaded with wildly different meanings, both in the Scala world and in the programming world more generally.

@scabug
Copy link
Author

scabug commented Aug 10, 2016

Tongfei Chen (ctongfei) said:
"LazyList" is a good name: it means a delayed-evaluation version of a Cons list ("List"). "Stream" is just too semantically overloaded and ambiguous.

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

4 participants