Aladdin - Scala Bugtracking
[#1153] project: api priority: low category: bug
submitter assigned to status date submitted
Nikolay Sean open 2007-05-30 13:16:14.0
subject [contrib #572] Stream.hasDefiniteSize should return false
code
Stream.from(1).hasDefinedSize
what happened
Stream.hasDefiniteSize always returns true.
what expected Stream.hasDefiniteSize should always return false. Or, maybe, some streams should return true, for example, Stream.empty, Stream.range
[back to overview]
Changes of this bug report
Nikolay  edited on  2007-05-30 13:18:12.0
The said method is defined in Collection as final def hasDefiniteSize = this.isInstanceOf[Collection[Nothing]]. This is clearly bogus since whether the type parameter is Nothing cannot be checked at runtime.
Sean  edited on  2007-07-17 17:41:04.0
I use .asInstanceOf[Collection[Nothing]] to talk about Collection's erased type, as Nothing won't be checked at run-time it doesn't matter...for now :) I'm stuck on this, is stream a collection or not? I thought the difference between Seq and Iterable is that Seq's are finite while Iterables may not. We've already argued about this before. If we are going to be making more exceptions, then maybe we should say Seq's may not have a well-defined size, and add something else that does?