storm-enroute / coroutines

Scala coroutines implementation.
http://storm-enroute.com/coroutines
BSD 3-Clause "New" or "Revised" License
162 stars 20 forks source link

extends Iterable/Iterator? #45

Open ctongfei opened 7 years ago

ctongfei commented 7 years ago

Since the functionality of this is very similar to the C#/python yield, I wonder if Coroutine._0[Y, R] could extend Iterable[Y] and Coroutine.Instance[Y, R] could extend Iterator[Y]. It makes looping on coroutines easier.

axel22 commented 7 years ago

Since Iterator is not specialized and creates boxed objects for primitive types (e.g. Iterator[Int]), it would be safer to be explicit, and add a conversion method to the coroutines-extras project.

ctongfei commented 7 years ago

That'll be fine too :-) Thanks