From: Robert Dober Date: 2006-06-23T18:12:27+09:00 Subject: Re: Class#name= ------=_Part_18802_7681297.1151053944502 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: quoted-printable Content-Disposition: inline On 6/23/06, Yukihiro Matsumoto wrote: > > Hi, > > In message "Re: Class#name=3D" > on Fri, 23 Jun 2006 06:42:09 +0900, Joshua Haberman < > joshua@reverberate.org> writes: > > |Is there any reason that Class#name=3D shouldn't exist? > > Modules and classes are named by the constant referencing it. If you > want to name an anonymous module, see the following code: > > mod =3D Module.new > NewModule =3D mod > p NewModule.name # =3D> "NewModule" > > matz. I have been inspired by this, and I found this behavior irb irb(main):001:0> mod =3D Module.new =3D> # irb(main):002:0> mod.name =3D> "" ok understandable irb(main):003:0> A =3D mod =3D> A irb(main):004:0> mod.name =3D> "A" most surprising irb(main):005:0> B =3D mod =3D> A irb(main):006:0> mod.name =3D> "A" even more surprising irb(main):007:0> B.name =3D> "A" ?????? irb(main):008:0> Well this kind of shocks me, is there an idea behind this which I am missing? If so could you please point me there. Sorry for being so direct, but that seems to be in violation with "Ruby should do what you expect it to do". Cheers Robert --=20 Deux choses sont infinies : l'univers et la b=EAtise humaine ; en ce qui concerne l'univers, je n'en ai pas acquis la certitude absolue. - Albert Einstein ------=_Part_18802_7681297.1151053944502--