Re: How does the class name magic with Class.new?

Matthew Kerwin <[email protected]> Mon, 10 Jun 2019 14:03:00 +1000
Newsgroups gmane.comp.lang.ruby.general
Message-ID <CACweHNCR1MSRko5NujUpBKokWw7otc3ktEEikVgtVjT7C2yYfw@mail.gmail.com>
Yeah, no, that's pretty much exactly how it works.

On Mon, 10 Jun 2019 at 13:51, John Carter <[email protected]> wrote:
>
> This seems like deep magic... Any idea how it works?
>
> a = Class.new
> => #<Class:0x0000558d34f68b48>
> > a.name
> => nil
> > B= a
> => B
> > a.name
> => "B"
> > C= a
> => B
> > C.name
> => "B"
>
> It seems as if whenever you create a Constant it checks to see to see
> if it is an unnamed class and then names it....
>
> That seems..... too magic.
>
> --
> John Carter
> Phone : (64)(3) 358 6639
> Tait Electronics
> PO Box 1645 Christchurch
> New Zealand
>
> --
> This Communication is Confidential. We only send and receive email on the
>
> basis of the terms set out at www.taitradio.com/email_disclaimer
> <http://www.taitradio.com/email_disclaimer>
>
> Unsubscribe: <mailto:[email protected]?subject=unsubscribe>
> <http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-talk>



-- 
  Matthew Kerwin
  https://matthew.kerwin.net.au/

Unsubscribe: <mailto:[email protected]?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-talk>