The "Pipeline" Operator - Making multiple function calls look great

Marius Gundersen gundersen at
Mon Dec 14 13:59:10 UTC 2015

Do we really need to add support for await in a pipeline syntax sugar when
there already is a piping support in `.then()`? If you need to await
something in that chain, then just use `.then()`.

let result = await fs.readFile('index.txt')
  .then(x => multiParamFunction(x, 10));

I really don't see much gain in adding this syntax when there is already a
FBS proposal that covers most of the cases. The pipe operator only supports
single param functions. With multiple params you either need to use
fat-arrow (while FBS handles multiple params) or you need a special
function that is curryable. So now we either need functions that is
curryable (for |>) or a function that relies on the `this` value (for FBS),
so libraries will probably need to be specially written for whichever
proposal is added to the spec. It looks to me like FBS adds a lot more
value than |> does.

On Mon, Dec 14, 2015 at 2:05 PM, Bruno Jouhier <bjouhier at> wrote:

> `await` could be handled by with contextual lexing: handling `|> await` as
> a single keyword.
> Another solution would be to collapse the two into a variant of the
> pipeline operator: `|await>`, `|!>`, ...
> This could be an opportunity to revive the syntax sugar that was proposed
> in
> ```js
> // concurrency strawman
> lines = fs.readFile!('./index.txt').split('\n');
> // pipeline operator
> lines = './index.txt' |!> fs.readFile |> str => str.split('\n')
> ```
> _______________________________________________
> es-discuss mailing list
> es-discuss at
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the es-discuss mailing list