Protean-Labs / mesh

The Mesh Engine that implements the Mesh Language, a computational language for web3.
Apache License 2.0
1 stars 0 forks source link

Add Grammar for pipes #43

Closed ThierryBleau closed 3 years ago

ThierryBleau commented 3 years ago

Add Grammar:

let f = (x) => x;

1 |> f;

Implement piping: expr_value pipe fun_expr -> EApp(fun_expr, expr_value)

Design: Should we use PAny for argument placement?

cvauclair commented 3 years ago

Piping is technically already supported as the pipe operator is an infix operator (which we can already parse). The only thing missing would be the implementation (See #54)

Should we use PAny for argument placement?

Not sure, but I think we should exclude this feature from the first implementation of the pipe operator.

cvauclair commented 3 years ago

Should we use PAny for argument placement?

Actually, I think this is separate from the pipe operator, as f(_, x) is, by itself, a valid expression. E.g.: A, B and C are basically equivalent

let f = (x, y) => x / y;

// A
let f' = f(_, 2);
f'(1);

// B
f(_, 2)1;

// C
1 |> f(_, 2);