H
Hal Fulton
I hate to bring up possible language changes, since there is
so much of that going around.
Matz, if this is stupid, just tell me so.
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.
Two examples are:
1. A long string, possibly multiline/multi-statement, is being
evaled. I want the capability to abort the eval.
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__
In both these contexts, I initially tried exit. Of course, that
doesn't work -- it exits the entire program. A "return" seems like
the next choice, but that only makes sense within a method.
There's no proper way to do this kind of thing, as far as I can
see.
Thoughts?
Hal
so much of that going around.
Matz, if this is stupid, just tell me so.
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.
Two examples are:
1. A long string, possibly multiline/multi-statement, is being
evaled. I want the capability to abort the eval.
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__
In both these contexts, I initially tried exit. Of course, that
doesn't work -- it exits the entire program. A "return" seems like
the next choice, but that only makes sense within a method.
There's no proper way to do this kind of thing, as far as I can
see.
Thoughts?
Hal