Why is there no goto statement?


Anticipated return can be used to jump out of a method, and that's enough to emulate structured gotos like C's break statements.

Otherwise, you can use exceptions to provide a "structured goto" that even works across function calls. Exceptions are particularly powerful in Smalltalk, as they allow resuming the execution at the point the exception was thrown, as well as retrying the execution of the piece of code that triggered an exception.

^[ self assert: (Date daysInMonth: #feb forYear: Date today year) = 29 ]
    on: Error
    do: [ :ex |
        (Delay forSeconds: Time secondsPerDay) wait.
        ex retry ]

Exceptions should be able to conveniently emulate all reasonable uses of "goto".

User login