On Nov 11, 2011, at 10:25 AM, gaz Heyes wrote:
> On 11 November 2011 18:01, Dmitry Soshnikov <dmitry.soshni...@gmail.com>
> wrote:
> var foo = {
> // do stuff
> 100;
> };
>
> What would be the result of a labelled statement? You'd need labels to work
> within expressions since you'd probably want to do:
> x=loop:for(i=0;i<10;i++){
> }
>
> but then what if you do:
> x=1/loop:for(i=0;i<10;i++){
> }
>
> Is 1 divided by the result of the for loop or is it divided by undefined?
My last reply suggested making unlabeled keyword-statement (statements that
start with a reserved identifier) be assignment expressions, so if you remove
the loop: label, you would have to parenthesize:
x=1/(for(i=0;i<10;i++){
})
to get it to compile. If we extend things to support LabelledStatement as well
as KeywordStatement as right parts of AssignmentExpression, then you'd still
need parens and it would all work.
I haven't thought through other potential issues with labels, though.
As noted, blocks in parentheses are *out*. No can do.
/be
_______________________________________________
es-discuss mailing list
es-discuss@mozilla.org
https://mail.mozilla.org/listinfo/es-discuss