trustedtomato/proposal-partial-expression

Rename this proposal?

Closed this issue · 5 comments

I think a name e.g. 'Arrow Function Shorthand Syntax' would be better because this proposal essentially is to introduce a shorthand syntax for arrow functions.

You can do some things with arrow functions which you can't using this syntax.

  • (Currently) there is no way to use statements. For example, you can't put a for loop to a partial expression while you can put it into an arrow function.
  • The way to refer to outer layers (aka ??, ???, etc.) will be probably removed. See #4.

And this syntax' general use case is to partially apply an expression (generally function, operator or method), so that name wouldn't be really intuitive.

  1. Yeah, it's a shorthand only for (...) => expression not (...) => { statement } but I think it's okay.
  2. It's true that this proposal will be useful for the partial application but I think a name should show what it does, not what it's expected use case is.

Well, actually, a function is essentially a chunk of code what has some parts which are variable (arguments). So we could call them as partial code syntax. That doesn't sound good at all.
In this case, the chunk of code must be an expression => its a partial expression. So I think its perfectly valid.
If we want to stay valid & we want to mention that this is a shorthand, we must call it something like "Arrow Function For Expression Shorthand Syntax (where we can't use arguments from outer functions using this syntax)" which is not a very nice name.
I would rather stay with the current one.

Note that the Arrow function syntax is also called Arrow function syntax rather than Function shorthand syntax :).

Closing due to inactivity.