From: phrogz@... Date: 2006-08-18T14:00:05+09:00 Subject: Re: Perl Junkie: Bad form? > This is what I would rather be doing, generally, for imported utility > type routines -- making them look "native." I understand (pretty much) > about the separate namespace issue, and namespaces are certainly nice > (both in Perl and in Ruby). But sometimes I want to pretend I have > something "natively" available to me, and this seemed to work. > > Ugly? Right? Hackish? A better way? Looking for the Ruby > perspective here because this is probably one of my more unsolved > delimmas -- how to view, approach and implement cases like this. You understand the namespace issue, but you know what you want. I'd say "Go for it!". The power is in your hands. Ruby lets you open up classes and redefine them after the fact. Why shouldn't you do this at the global or Kernel level? (In case it helps, let me plug http://phrogz.net/RubyLibs/RubyMethodLookupFlow.png to help you discern the various areas where you might choose to inject your addons. The 'main' object is an Object.) One other thing - if you KNOW you always want global functions, why not just define them as such in the included file? If you're not sure, then probably you should pull the 'include' statement out of your separate file. That means when you DO want them global, you'll need to do: require 'foo' include Foo but at least you'll still have an option.