Hi,
In message "Generalized break?"
on 03/12/05, Hal Fulton <hal9000 / hypermetrics.com> writes:
|I've sometimes wished for a "break" that would work in (almost) any
|context -- one that would do "the sensible thing" instead of just
|giving an error saying you can't do a break here.
"break" or jump in general requires destination. If you want
something like "generalized break", you have to define the destination
for each context. Basically, catch/throw is prepared for that
purpose.
|1. A long string, possibly multiline/multi-statement, is being
|evaled. I want the capability to abort the eval.
Use catch/throw.
|2. I have a mild dislike for the idiom if $0 == __FILE__ (lines) end
|-- because I always indent inside an if, and I don't want to indent,
|and I really just want to say: break if $0 != __FILE__
I think it's not a good idea that preparing single syntax construct to
serve too many purpose. I admit "$0 != __FILE__" hack is ugly, but it
should be solved by some other way than "generalized break.
matz.