From: David Vallner Date: 2006-08-18T07:25:09+09:00 Subject: Re: Perl Junkie: Bad form? On Fri, 18 Aug 2006 00:05:04 +0200, /usr/ceo wrote: >> Those who remember, I actually advocate allowing the client >> programmer create a namespace for libraries instead of the >> library writer, too, but that is another discussion. > > So are you advocating this (by your last statement especially)? > > my/utils.rb: > > module Utils > def mputs( *args ) > args.each { |n| puts n } > end # def > end # module > > myscript.rb: > > #!/usr/bin/env ruby > > require 'my/utils' > include Utils > > mputs( > "Line 1", > "Line 2", > "Line 3" > ) If I understood right, he advocates adding into ruby a construct that would do: my/utils.rb: def mputs( *args ) args.each { |n| puts n } end myscript.rb: require 'my/utils' as Utils Utils.mputs("Womble", "Fluff") where if you'd omit the 'as' clause, mputs would be in the global namespace. Which is a nifty idea, but I'd also like to see file-scoped or lexically-scoped require along with it, since this still lets someone thrash the global namespace for scripts that are unaware of this.