Proposal: expression mode (=)

Isiah Meadows isiahmeadows at gmail.com
Tue Nov 1 12:49:47 UTC 2016


I like the idea of expressions over statements (it's actually my
preference), but not at the cost of breaking *everything* (feel free to
fork Acorn/Escodegen and create your own transpiled JS variant - their
licenses permit it), so my support of your particular idea is pretty much
nil, at least in the JavaScript standards.

On Tue, Nov 1, 2016, 03:10 Yongxu Ren <renyongxu at gmail.com> wrote:

> Isiah, In your case, if we do
> ```
> var x = = { a }
> ```
> there isn't much difference from the `do expression`, actually, it might
> be worse since it looks confusing. if it can not be omitted, I'd rather
> stay with `do`.
>
> The intent for this proposal is to allow writing better functional code in
> javascript. IMO, the `do expression` is a good start, but I think using `=`
> (and other operators) is a more elegant since it can be omitted.
>
> Actually, I think I have a better idea to put it together:
>
> *1. besides defining a function, if the block can be legally be replaced
> by an expression, while otherwise it would cause parsing error, convert it
> to expression block*
>
> *2. if the case is ambiguous or it is been used in function declaration,
> adding `=` (actually, using `do` here isn't a bad idea either, but can be
> quite ugly for defining function) will enforce block to be parsed as
> expression*
>
> The goal is to make javascript more functional friendly.
>
>
> _______________________________________________
> 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/20161101/2745469b/attachment.html>


More information about the es-discuss mailing list