question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

rename 'Iterable' to 'Stream' w/o breaking code

See original GitHub issue

Alright, so here’s a thing I’ve wanted to do forever. It turns out that Iterable is a really terrible name for the things we call “streams”. The whole perspective of working with streams is to not think of procedurally “iterating” over them. Now, sure, Ceylon’s Iterable historically grew out of something that filled the same role as Java’s interface of the same name, but it has grown into something quite different.

Now, we could renameIterable to Stream without breaking any existing source code simply by creating an alias for it:

shared interface Iterable<out Element=Anything,
                          out Absent=Null> 
        given Absent satisfies Null
        => Stream<Element,Absent>;

We could even make it binary compatible by simply munging the name Stream back to Iterable in the backend, but at this point I’m not sure that’s even worth the effort, since we’re breaking binary compatibility in the next release anyway.

Thoughts?

Issue Analytics

  • State:open
  • Created 6 years ago
  • Reactions:3
  • Comments:30 (26 by maintainers)

github_iconTop GitHub Comments

6reactions
gavinkingcommented, Aug 28, 2017

hey, y’know what would be the coolest thing ever?

A renamed annotation that:

  • tells the typechecker and model loaders to automatically generate an alias with the old name of a decaration,
  • tells the backends to keep using the old name in compiled code, and
  • tells the IDEs to prompt to rename to the new name.
renamed ("Iterable")
shared interface Stream<out Element=Anything,
                          out Absent=Null> 
        given Absent satisfies Null { ... }

That would be cool and not even very hard to implement!

3reactions
jvasileffcommented, Sep 24, 2018

Based on the above two comments, I suppose that between Iterable and Iterator, it makes more sense for Iterator to be renamed to Stream than for Iterable to be renamed.

Stream is a really nice name, and I think it would be a waste to use it on something so useless as an Iterator, which is primarily just a temporary object used by for loops. And even if Stream isn’t otherwise used, I’m not sure giving Iterators a nice name would do anything other than encourage overuse (misuse).

Read more comments on GitHub >

github_iconTop Results From Across the Web

Iterable to Stream in Java - Baeldung
This simple tutorial shows how you can convert an Iterable instance into a Stream instance and perform standard operations on it, just like...
Read more >
Change log — Pywikibot 8.0.0.dev0 documentation
Short site value can be given if site code is equal to family like -site:meta or -site:commons ... tzoneFixedOffset class was renamed to...
Read more >
Faust Documentation
Faust is a stream processing library, porting the ideas from Kafka Streams to Python. It is used at Robinhood to build high performance ......
Read more >
docs: writable streams from async iterators example issue ...
Given the example from https://nodejs.org/api/stream.html# ... doc: rename iterator to iterable in examples
Read more >
Hypothesis Documentation - Read the Docs
It is intended for internal use, to ease code reuse, and is not stable. Point releases may move or break the contents at...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found