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

Reply via email to