Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

A real GOTO in Javascript would be extremely welcome. Commenters bemoaning the idea are missing the point. The value is not in writing GOTOs by hand, but in a greatly expanded ability to add higher-level abstractions to the language. For example, we have a lot of JS with nested functions. There's no good way to say "return from the top-level function"; the return keyword only gets you out of the current level. If we had something like CL's return-from we could do more with JS. There are many such examples. (Edit: the while-loop hack that's used here might be useful for this. I had thought about implementing it with throw/catch but that seemed too heavyhanded.)


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: