Option is not Iterable

Is there a reason Option is IterableOnce but not Iterable?

I would guess because it wouldn’t be able to provide many of the methods Iterable provides, like ++ or +

In general, Option is only similar to List or other collections in that it can be folded / traversed; but the stdlib doesn’t provide the right abstractions for that.

3 Likes

Make Option extend IterableOnce by lrytz · Pull Request #8038 · scala/scala · GitHub links to a slew of past discussions on this

2 Likes