Proposal: expression mode (=)

Caitlin Potter caitpotter88 at gmail.com
Sun Oct 30 15:01:21 UTC 2016


> On Oct 30, 2016, at 10:45 AM, Yad Smood <y.s.inside at gmail.com> wrote:
> 
> I think `label: ’value'` is not a legal statement I think, so you actually can distinguish them.

"use strict"; is a valid Statement, so why not?

My read of this was that it uses := instead of = to work around this ambiguity.

I think the do-expressions idea is more powerful, though, since it's a valid RHS operand to any binary op, whereas this looks limited to assignment.


> 
>> On Sun, Oct 30, 2016 at 10:17 PM JongChan Choi <jong at chan.moe> wrote:
>> ambiguous case
>> 
>> ```
>> let x = {
>>     // statements here?
>>     label: ’value'
>> };
>> ```
>> 
>>> 2016. 10. 30., 오후 5:54, JongChan Choi <jong at chan.moe> 작성:
>> 
>>> 
>>> OMG sweet! I love it.
>>> then how it’ll be formed when mixed with labeled statement?
>>> 
>>>> 2016. 10. 30., 오후 3:15, Yongxu Ren <renyongxu at gmail.com> 작성:
>>>> 
>>>> Yes, it does the exact same thing.
>>>> I think using = and operators is a bit cleaner than 'do'.
>>>> However, The biggest advantage for this feature is you can write functional code without extra syntax.
>>>> Allowing block to return value will allow you to write concise code like in ocaml Haskell or scala.
>>>> 
>>>> On Sunday, October 30, 2016, Olivier Lalonde <olalonde at gmail.com> wrote:
>>>> Sounds like the "do expressions" proposal. http://wiki.ecmascript.org/doku.php?id=strawman:do_expressions
>>>> 
>>>> On Sat, Oct 29, 2016 at 5:32 PM, Yongxu Ren <renyongxu at gmail.com> wrote:
>>>> potentially, this syntax can be extended to functions
>>>> ```
>>>> function f() ={stat}
>>>> // is equivalent to
>>>> function f() {return stat}
>>>> 
>>>> 
>>>> let f = () => ={stat}
>>>> // are equivalent to
>>>> let f = () => stat
>>>> ```
>>>> 
>>>> it can also be applied to `try...catch`.... and more, such as
>>>> 
>>>> ```
>>>> // pattern matching
>>>> match(expr) {
>>>>   pattern1:={
>>>>     //block
>>>>   }
>>>>   pattern2:={
>>>>     //block
>>>>   }
>>>>   pattern3:={
>>>>     //block
>>>>   }
>>>> }
>>>> 
>>>> _______________________________________________
>>>> es-discuss mailing list
>>>> es-discuss at mozilla.org
>>>> https://mail.mozilla.org/listinfo/es-discuss
>>>> 
>>>> 
>>>> 
>>>> 
>>>> -- 
>>>> - Oli
>>>> 
>>>> Oli Lalonde
>>>> http://www.syskall.com <-- connect with me!
>>>> _______________________________________________
>>>> es-discuss mailing list
>>>> es-discuss at mozilla.org
>>>> https://mail.mozilla.org/listinfo/es-discuss
>>> 
>>> _______________________________________________
>>> es-discuss mailing list
>>> es-discuss at mozilla.org
>>> https://mail.mozilla.org/listinfo/es-discuss
>> _______________________________________________
>> es-discuss mailing list
>> es-discuss at mozilla.org
>> https://mail.mozilla.org/listinfo/es-discuss
> _______________________________________________
> 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/20161030/8eca6c4f/attachment.html>


More information about the es-discuss mailing list