I also thought as much, but after a [long discussion]( https://github.com/mindeavor/es-pipeline-operator/issues/20) we determined the current proposal is better – it's simple and doesn't change any semantics of invocation. Also, arrow functions are a fine solution to working with functions that take multiple arguments, esp. since they can be optimized out by the compiler (as I do in my [babel plugin]( https://github.com/babel/babel/pull/3159)).
On Sat, Dec 12, 2015 at 3:21 PM, Isiah Meadows <[email protected]> wrote: > Is there a reason why it couldn't desugar to `f(x, y)` or `f(y, x)`? I > think it would be more performant with mostly the same benefits, and it > would work better with existing libraries, as a compliment to the function > bind proposal. > > On Sat, Dec 12, 2015, 16:01 Gilbert B Garza <[email protected]> > wrote: > >> `x |> f(y)` desugars to `f(y)(x)` >> >> On Sat, Dec 12, 2015 at 2:55 PM, Isiah Meadows <[email protected]> >> wrote: >> >>> Question: does `x |> f(y)` desugar to `f(x, y)`, `f(y, x)`, or `f(y)(x)`? >>> >>> On Sat, Dec 12, 2015, 12:17 Gilbert B Garza <[email protected]> >>> wrote: >>> >>>> Ah yes, you are correct, it would need to be a special case as I wrote >>>> it. This version should work instead: >>>> >>>> ```js >>>> // Assume fs.readFile is an `async` function >>>> async function runTask () { >>>> fs.readFile('./index.txt') >>>> |> await >>>> |> file => file >>>> .split('\n') >>>> .map(fs.readFile) >>>> |> Promise.all >>>> |> await >>>> |> all => all.join("\n") >>>> |> console.log >>>> } >>>> ``` >>>> >>>> On Fri, Dec 11, 2015 at 7:08 PM, Kevin Smith <[email protected]> >>>> wrote: >>>> >>>>> ```js >>>>>> // Assume fs.readFile is an `async` function >>>>>> async function runTask () { >>>>>> './index.txt' >>>>>> |> await fs.readFile >>>>>> |> file => file >>>>>> .split('\n') >>>>>> .map(fs.readFile) >>>>>> |> await Promise.all >>>>>> |> all => all.join("\n") >>>>>> |> console.log >>>>>> } >>>>>> ``` >>>>>> >>>>> >>>>> This doesn't work unless you special case the semantics of await >>>>> expressions. With the current semantics, `await fs.readFile` will just >>>>> await `fs.readFile` not the result of applying it. >>>>> >>>>> >>>> _______________________________________________ >>>> es-discuss mailing list >>>> [email protected] >>>> https://mail.mozilla.org/listinfo/es-discuss >>>> >>> >>
_______________________________________________ es-discuss mailing list [email protected] https://mail.mozilla.org/listinfo/es-discuss

