John Lenz (2014-08-25T15:11:58.000Z)
domenic at domenicdenicola.com (2014-09-08T23:20:52.280Z)
On Mon, Aug 25, 2014 at 2:17 AM, Salvador de la Puente González <salva at unoyunodiez.com> wrote: > AFAIK, jumping to a label is not possible in ES5. You can only skip a > labelled sentence. Indeed you can use the next information for changing the > state. It's how I'm doing it right now but transpiling the functions this > way is quite obscure. > > I don't know if there are goto discussions in this list but it is one of > my concerns, if JS is becoming something like the "high level target > language of the web", to provide a powerful enough flow control sentence > like goto. > > I know the dangers behind this sentence and this is because I propose to > limit its usage inside generators where scope is controlled and limited. > You can not jump between functions and the jumping is controlled > externally. The proposed goto() method does not send or advances the > generator, it only changes the execution point. It can be completed with > gen#yields() which would return all labels for labelled yields. Superficially, this sounds like a switch statement. I have a hard time envisioning something that is more powerful and doesn't cause lots of problems. ```js switch (start) { case 1: yield something; // fall through case 2: yield something; } ```