Label statement moveable

Brendan Eich brendan at mozilla.org
Tue May 26 19:48:01 UTC 2015


I'm not sure what you mean by limited goto, but your example works since 
ES3 in JS. Underused part of the design: break from labeled block or if, 
no need for do-while(0) nonsense.

/be

Michał Wadas wrote:
> I'm not sure if limited "goto" should be really considered harmful.
> Dijkstra has written his essay on unlimited goto, that could jump from
> any point in code to any other point in code.
> I don't see reason why limited "goto" that is semantically equivalent
> (or little more powerful) to
> x: do {
> continue x;
> } while(false);
>
> should be considered harmful (anyway - it's useful almost only for
> implementing state machines).


More information about the es-discuss mailing list