No 'fold left' without a combiner ?

Remi Forax forax at univ-mlv.fr
Tue Sep 10 08:42:23 PDT 2013


On 09/09/2013 05:32 PM, Brian Goetz wrote:
>> or better, have a foldLeft (or whatever it's name) on Stream that throws
>> an IllegalStateException if the stream is parallel.
>
> No, that's not better :)
>
> The pervasive sequential-think that most developers bring to the table 
> in 2013 is not anyone's friend.  We've gone to great effort to design 
> an API where, if properly used, works correctly regardless of whether 
> the pipeline executes sequentially or in parallel.  The result is a 
> cleaner and simpler API, and one that better prepares developers for 
> computing in the coming decade.
>
> Adding a handful of sequential-only operations may make certain use 
> cases easier, but there's a hidden cost -- reasoning about stream 
> pipelines becomes harder for everyone, because now parallel 
> compatibility becomes an element of the model which must be 
> considered.  Short-term gain, long-term pain.  No thank you!

so for my example, the idea is to *not* use a stream and use a for loop 
instead, right ?

>
> Please deposit your sequential glasses in the bin by the door. You 
> won't be needing them any more.
>

:)

Rémi



More information about the lambda-libs-spec-experts mailing list