We shouldn't be making backwards-incompatible changes for features just because 
they can be abused. Every feature can be abused. And simplifying the completion 
type is not even remotely an important goal.

Sometimes labels are just necessary. Sometimes you have a loop that needs an 
early return, and you're doing a switch inside that loop, and there's no way to 
break out of the loop without the label. Labels are even more important for 
code generators, which need to implement non-trivial control flow. The one hand 
giveth compiler writers tail calls, the other taketh away labels? I sure hope 
not!

But I'll try to resist writing long, impassioned defenses about uncontroversial 
features of the language. The barrier to making backwards-incompatible changes 
is high (see Brendan's "five fingers of fate"), and we should only consider 
removing *extremely* problematic features.

Dave

On Apr 9, 2011, at 1:33 AM, Peter van der Zee wrote:

> Can we remove labels from the next version of the spec?
> 
> Labels are only used for continue and break. I don't think I've ever had or 
> seen a need for them (which does not mean they're unused, btw). They can be 
> sugar insofar as to breaking a double loop at once. But at the same time they 
> promote spaghetti coding. On top of that there's a decent impact on the 
> specification. In fact, I'm a little surprised they were not excluded from 
> strict mode.
> 
> So nothing would really change for label-less `continue` and break. 
> 
> Switch and iterations would not get an empty label (obviously) and the whole 
> label stack could be stripped.
> 
> Furthermore the grammar for continue and break would be as simple as that for 
> debugger. And the label statement would disappear (which is nice because at 
> the start of a statement, if the first token is an identifier, you need to 
> parse another token before being able to determine whether you're parsing a 
> label or an expression).
> 
> The completion type (8.9) would no longer need to have three parameters, just 
> two.
> 
> Am I missing anything? Or are there cases where labels allow you do something 
> that's impossible without labels?
> 
> - peter
> _______________________________________________
> es-discuss mailing list
> es-discuss@mozilla.org
> https://mail.mozilla.org/listinfo/es-discuss

_______________________________________________
es-discuss mailing list
es-discuss@mozilla.org
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to