-
Notifications
You must be signed in to change notification settings - Fork 21
Closed
Description
If a stream is defined as follows:
val s: Stream [Int] = 1 #:: s
then it can be printed as long as its tail has not yet been defined.
If however the tail is accessed (e.g. by invoking s(1)
) then printing eagerly runs in a loop until the memory is exhausted:
scala> s
res0: Stream[Int] = Stream(1, ?)
scala> s(1)
res1: Int = 1
scala> s
<hangs>
@retronym located the bug in method Stream.addString.
See also the discussion on the scala-language list.