Function composition vs pipeline

Naveen Chawla naveen.chwl at gmail.com
Sat Feb 24 09:21:43 UTC 2018


That could be a problem for readability.
I agree with the rest of what you said.

On Sat, 24 Feb 2018 at 11:16 Viktor Kronvall <viktor.kronvall at gmail.com>
wrote:

> I don’t know the implications but I could easily imagine the pipeline
> proposal being extended to not taking any input on the left hand side and
> effectively represent composition in the opposite direction.
>
> For example:
> ```
> let h = |> f |> g
> h(2) //g(f(2))
> ```
>
> That said, the point holds for the proposal in its current state. Being
> able to compose functions
> leads to much more expressivity than if you have
> to call the pipeline (and collapse) where it is defined.
> 2018年2月24日(土) 14:32 Naveen Chawla <naveen.chwl at gmail.com>:
>
>> The function composition operator composes function pipelines into
>> functions for later use and/or further composition. Those functions still
>> need to be called via the existing `()` syntax, so it doesn't offer a
>> different way of calling functions as such.
>>
>> The function pipeline operator calls the function pipeline immediately,
>> so it is really only a different way of calling functions.
>>
>> On Fri, 23 Feb 2018 at 12:37 Jordan Harband <ljharb at gmail.com> wrote:
>>
>>> How is either operator not "a different way of calling functions"?
>>>
>>> On Thu, Feb 22, 2018 at 8:34 PM, Naveen Chawla <naveen.chwl at gmail.com>
>>> wrote:
>>>
>>>> I was just thinking about the relative merits and coexistence (or not)
>>>> of function composition operator and function pipeline operator features:
>>>>
>>>> e.g.
>>>>
>>>> https://github.com/TheNavigateur/proposal-pipeline-operator-for-function-composition
>>>> https://github.com/tc39/proposal-pipeline-operator
>>>>
>>>> They can of course co-exist, but there is overlap only in the respect
>>>> that both allow function pipelines to be called from left to right (except
>>>> the input parameter in the case of the composition feature, which requires
>>>> existing bracket syntax to be used to call it). If one were to be chosen,
>>>> would say that a function composition operator adds a whole new dimension
>>>> of expressive power to the language, whereas a pipeline operator only
>>>> offers a different way of calling functions.
>>>>
>>>> I was wondering about all of your thoughts about whether you'd prefer
>>>> only the pipeline operator, only the composition operator, or both, or
>>>> neither to be added to the language (these are pretty much all the
>>>> possibilities), and why.
>>>>
>>>> _______________________________________________
>>>> es-discuss mailing list
>>>> es-discuss at mozilla.org
>>>> https://mail.mozilla.org/listinfo/es-discuss
>>>>
>>>>
>>> _______________________________________________
>> es-discuss mailing list
>> es-discuss at mozilla.org
>> https://mail.mozilla.org/listinfo/es-discuss
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20180224/2d4294c9/attachment.html>


More information about the es-discuss mailing list