Michael Vogel wrote:
Didn't know that, I thought, Break would pop some jump addresses from a stack or does something else in an elegant way, while goto could leave a lot of waste on the heap.
I was talking from the high level point of view, from a language perspective, maybe I should have make myself more clear.
Anyway, from an implementation point of view, from what I saw Break is translated as a direct jump, so.. there you have it
The fact Break is a "redefined forward-only GOTO with limited scope" it's a good thing in the sense it makes impossible a misuse of GOTO in its place.
You can jump but only where it's safe: for example not from inside a select/endselect which is using the stack, simply because Break is not accepted there.
You cannot jump in the middle of another piece of code where you don't have a right to be: simply because you can't express that destination using a Break followed by a number.
You can jump only in a "stylish" way: you can't jump backward, usually something easily avoidable in a structured high level language.
Adding a destination label for a Break will strip all this from it, unless the compiler is loaded with checks about its use. Not needed now.
Break N with N > 1 is already pushing the envelope of what Break should do (it's also really ugly and hard to follow and maintain compared to a clean use of GOTO in my opinion).
For everything else we have GOTOs, to be used in a proper way like anything else.
Now that we have local labels to be paired with GOTOs I'm quite happy with it.
Michael Vogel wrote:
Shouldn't be Break 42 the perfect solution?
You can try it and report back
