From: Alex Young Date: 2011-06-08T20:57:05+09:00 Subject: [ruby-core:36844] Re: [Ruby 1.9 - Feature #4840][Open] Allow returning from require On 08/06/11 01:33, Yukihiro Matsumoto wrote: > Hi, > > In message "Re: [ruby-core:36811] Re: [Ruby 1.9 - Feature #4840][Open] Allow returning from require" > on Tue, 7 Jun 2011 19:10:15 +0900, Yusuke ENDOH writes: > > |Agreed. > > Ah, I understand the request. But returning from outside of a method > makes me so weird. To me, return would imply that the returned value should be passed back by the original require call, like so: $ cat a.rb return 42 $ cat b.rb p require("a") $ ruby -I. b.rb 42 That could be *really* handy, although it's not compatible with my previous suggestion (currently languishing here: http://redmine.ruby-lang.org/issues/4523 - any comments?). An already-loaded file can still be signaled by a nil return value, and a file could pretend to be already loaded (if that's at all useful) by choosing nil as its return value... Food for thought :-) -- Alex