> Le 26 mai 2015 à 21:48, Brendan Eich <[email protected]> a écrit :
> 
> 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


I guess that his example misreferred to my case earlier in that thread:

```
foo: do {
    // ...
    if (bar)
        continue foo
    // ...
    break 
} while (true)
```
(It’s too easy to miss that `continue` applied to `while(false)` doesn't do 
what is meant.)

Anyway, for rare cases not covered by `break label`, as you noted, proper tail 
call is a satisfactory way to spell  `goto`:
```
;(function foo() {
    // ...
    if (bar)
        return foo()
    // ...
})()
```

—Claude

> 
> 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).
> _______________________________________________
> es-discuss mailing list
> [email protected]
> https://mail.mozilla.org/listinfo/es-discuss

_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to