On dropping @names

Claus Reinke claus.reinke at talk21.com
Thu Dec 6 13:26:02 PST 2012


>> I was hoping for something roughly like
>>
>>    let lhs = rhs; statements
>>        // non-recursive, scope is statements
>>
>>    let { declarations }; statements        // recursive, scope is
>> declarations and statements
> 
> Problem is that you need mutual recursion between different 
> binding forms, not just 'let' itself.

Leaving legacy var/function out of it, is there a problem with
allowing mutually recursive new declaration forms in there?

    let { // group of mutually recursive bindings

        [x,y] = [42,Math.PI]; // initialization, not assignment

        even(n) { .. odd(n-1) .. } // using short method form
        odd(n) { .. even(n-1) .. } // for non-hoisting functions

        class X { .. }
        class C extends S { .. new X( odd(x) ) .. }
        class S { }
    };
    if (even(2)) console.log(  new C() );

Or did I misunderstand your objection?
Claus
 


More information about the es-discuss mailing list