Native Function Composition

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Native Function Composition

Simon Staton
I'm not sure if this has been proposed before, if not I would like to propose a native way to handle function composition.

This is not that trivial, it can be achieved via a generic utility however considering this is quite a common pattern it might make sense to include it as a native feature set

Something along the lines of

Function.prototype.compose(); // chained at end of callstack
Function.prototype.composeBefore();

This could A) return a new function B) chain from the original reference

Quite often composition is not limited to a single function so it could be a better approach to allow multiple arguments to be chained

Could also follow a similar design as the Java implementation

Regards,
Simon Staton

_______________________________________________
es-discuss mailing list
[hidden email]
https://mail.mozilla.org/listinfo/es-discuss