Hacker News new | past | comments | ask | show | jobs | submit login

Control structures are high level abstractions around common patterns found with jumps and conditional branches. Many such patterns have been identified, ranging in complexity from simple loops and conditionals to non-local returns to cooperative multi-threading.

To assert that there is no possible good use for GOTO implies that every conceivable control flow pattern has a more clean and intuitive implementation using only the high level control structures.

When you consider the variation, from language to language, in the selection of control structures available, the conjecture seems absurd. At the very least, GOTO is a reasonable compromise when forced to use a language like C, which lacks structures for such common patterns as exceptions, among others.

What is certainly worse than using GOTO is contorting code to use high level control structures in counter-intuitive ways, or worse yet, implementing ad-hoc control mechanisms using conditional variables. For purposes of readability, an informatively labeled GOTO is greatly preferable to such obfuscation.

Fortunately, we have versatile languages like LISP and Ruby which provide a rich library of control flow abstractions and allow us to create our own using closures. For the rest of the world, let them have their GOTO.




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

Search: