[fpc-pascal] The reason why linus torvalds hate-pascal
Vinzent Hoefler
JeLlyFish.software at gmx.net
Mon Apr 21 08:45:44 CEST 2008
On Sunday 20 April 2008 19:21, Andreas Berger wrote:
> About break. I would like to see an implementation of Break(x) where
> x is the number of loops to break out of.
> Correction: I would not like this, I would LOVE it.
Oh, another Adaism trying to creep into Pascal...? :D
But let me revisit your proposal: Of course, break with such a "number
of level" argument breaks your code (hence the name?), once you add
another loop somewhere around it.
In that case I'd rather go with goto. At least there's a label and a
definite target to jump to.
The alternative is the named loop as in Ada, which makes it possible to
break out of more than just one loop, but wouldn't have the hassles of
a "where does this 'break (3)' lead us?". At least you name the loop
you want to abandon at the point of "exit" and you can look up the
label in the code, instead of counting the number of levels (and maybe
even missing one).
Sorry, but as much as you might think, you'd love this; if you really
need something like that, rather use "goto" or throw a bloody
exception.
Vinzent.
More information about the fpc-pascal
mailing list