From: "Mauricio Fernández" Date: 2003-12-06T05:27:38+09:00 Subject: Re: Generalized break? On Fri, Dec 05, 2003 at 12:05:20PM +0900, Yukihiro Matsumoto wrote: > |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. However sometimes having to define the destination is very inconvenient, as in > |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. Would it be possible to wrap each file/evaluated string in an implicit catch(:__END_INTERPRETATION__) do # a better name is 90% of the thing :) .... end ? -- _ _ | |__ __ _| |_ ___ _ __ ___ __ _ _ __ | '_ \ / _` | __/ __| '_ ` _ \ / _` | '_ \ | |_) | (_| | |_\__ \ | | | | | (_| | | | | |_.__/ \__,_|\__|___/_| |_| |_|\__,_|_| |_| Running Debian GNU/Linux Sid (unstable) batsman dot geo at yahoo dot com "You, sir, are nothing but a pathetically lame salesdroid! I fart in your general direction!" -- Randseed on #Linux