"Cancelable" streams
Brian Goetz
brian.goetz at oracle.com
Sat Dec 8 14:54:47 PST 2012
>> Parallel limit has some serious limitations that make it pretty
>> unsuitable for this case. While these may be fixable, the effort and
>> distortion involved is far, far greater than what is being suggested
>> here. In fact, I'm on the fence about whether to keep limit at all in
>> its current state; I worry people will expect more of it than it can
>> deliver, and be unhappy.
>
> I don't get it. You can check the limit the very same way you want to
> check shouldCancel.
Only in the serial case (easy) or in the parallel case where we know
that we don't have to respect encounter order. But in the general case,
encounter order is significant (consider a reduce with an associative
but not commutative reducing function), you can't just send the first N
that you happen to find through. limit(n) must send the first N in the
*encounter order* in this case. This is where the pain and complexity
comes from.
More information about the lambda-libs-spec-observers
mailing list