From: Minkoo Seo Date: 2006-06-02T07:08:01+09:00 Subject: Re: Package and Namespace ------=_Part_3519_28279750.1149199678805 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline Okay, here's another example. I have Point class provided by XYZ company. I also have Point class provided by ABC company. Now, I have to creates an instance of XYZ.Point from an instance of ABC.Point. How can I solve this problem? I have to mention ABC.Point and XYZ.Point in the same file. Sincerely, Minkoo Seo On 6/2/06, Minkoo Seo wrote: > > Thank you Kirk. > > Actually, the second question was my effort to think of some nice > example which mandates namespace concept in Ruby. > > But, you actually solved my contrived example. And I'm wondering > if there is any real problem that needs namespace. > > Sincerely, > Minkoo Seo > > > On 6/2/06, Kirk Haines wrote: > > > > On Thursday 01 June 2006 3:52 pm, Minkoo Seo wrote: > > > > > As you know, every modern language has namespace facility. > > > Even XML does have one to avoid name conflicts. Contrarily, > > > Ruby does not have explicit namespace facility. Though module > > > can provide with namespace facility it is not mandatory and > > > is not being used even in standard library. > > > > > > So, I'd like to ask two questions: > > > > > > 1) Don't you think Ruby need a package/namespace concepts? > > > > It does, though, as you yourself point out. The fact that it isn't > > mandatory > > isn't a problem. > > > > > 2) How would you solve the following problem: > > > > > > [Start of a.rb] > > > # I want to declare class Struct because I love that name so much. > > > # The name Struct perfectly describes my domain problem as well. > > > class Struct > > > end > > > > > > Foo = Struct.new :bar # I'd like to use Struct in standard library. > > > [end of a.rb] > > > > Simple. If you want to use Struct out of the standard library, then you > > have > > to put your Struct in a different space. > > > > module MyStuff > > class Struct > > # Struct stuff be found here.... > > end > > end > > > > my_struct = MyStuff::Struct.new > > > > > > Kirk Haines > > > > > > ------=_Part_3519_28279750.1149199678805--