Pure functions in EcmaScript

David Bruant bruant.d at gmail.com
Wed Nov 28 09:45:54 PST 2012


Le 28/11/2012 18:19, Claus Reinke a écrit :
>>> With many new functional programming possibilities (like map, 
>>> reduce, filter, lambdas) there are many scenarios where the 
>>> implementer should use pure (or as I renamed it in another reply, 
>>> side-effect-free) functions.
>> Why "should"? What is the problem if people don't?
>
> In the non-sequential versions, side-effect-free operators
> give more flexibility in scheduling, eg, splitting an array
> into sub-arrays, running partial loops on separate processors,
> then combine the results.
I agree, but it's far from being applicable in JS apparently (I see you 
agree later in your response). I suggested this as my very first 
Bugzilla bug. I encourage to read the comments: 
https://bugzilla.mozilla.org/show_bug.cgi?id=593706

David


More information about the es-discuss mailing list