From: Charles Oliver Nutter Date: 2011-06-08T16:38:04+09:00 Subject: [ruby-core:36831] Re: [Ruby 1.9 - Feature #4840][Open] Allow returning from require On Tue, Jun 7, 2011 at 7:33 PM, Yukihiro Matsumoto wrote: > Ah, I understand the request. ��But returning from outside of a method > makes me so weird. I agree with both the feature and the fact that return outside a method feels weird. An early termination of a loading file would be welcome; I've wanted this many times, and always ended up doing the super-gross "giant if" to accomplish what could be done by a simple early exit. I wonder if a core method that does the early return would be a better option, like Kernel#exit_script. It could be implemented to throw an exception all requires and loads expect to catch, like "ExitScriptError" or something. That would seem more consistent than having return end the script...but not actually be returning anything. Another option would be to use a different keyword that isn't so tied to method/proc bodies, like "break" break if defined? GitoriousConfig I think I like the exit_script version better, though. exit_script if defined? GitoriousConfig - Charlie