From: matz@... (Yukihiro Matsumoto) Date: 2001-06-27T03:20:59+09:00 Subject: [ruby-talk:16921] Re: rb_define_class() vs Class.new() Hi, In message "[ruby-talk:16918] Re: rb_define_class() vs Class.new()" on 01/06/27, Kero van Gelder writes: |Guy, I'm sorry that I'm not Guy. But I believe you admit me. |What would be the semantics of | | a = Class.new() | A, B = a, a | p a.name | |? | |(without giving any implementation detail, pls) Unnamed class object is referenced from two constants A and B. When a.name is called (or whenever class name is required), Ruby looks for the class name via internal constant table. Since constant table is a hash, it's hard to tell name would be either A or B. |What looks nicer: | - Object.const_set("A", Class.new) | - eval("class A; end") | - Class.new("A") | - I don't use classes - A = Class.new You can access the class via A whatever its name is. Class name is just a name. matz.