From: Kero van Gelder Date: 2001-06-25T07:09:20+09:00 Subject: [ruby-talk:16828] Re: rb_define_class() vs Class.new() > >>>>> "K" == Kero van Gelder writes: > > K> So, even though what I wanted is possible, isn't one of the ideas of > K> Ruby to allow you to write what you want consisely? > > K> Class.new(name) > > K> would be very short and very clear, if you ask me (name being a string > K> or a symbol, not sure whether both should be allowed). > > pigeon% ruby -e 'A = Class.new(Object); p A.name ; p A.type' > "A" > Class That's the unexpected feature, all right. Dave calls it cheating. I'll do some thorough thinking to determine whether I like or hate this. irb> a = Class.new() # irb> x = a.new() #<#:0x40269058> irb> B = a B irb> x # irb> A = a B Like, I already saw that classes only provide the methods and inheritance of methods, not any fields. Apparently this includes the name... I was thinking of implementing some debug() that prints depending on (run-time) configurable Class and Module names... Seems a bit futile, now... Bye, Kero. PS: executing pigeon% b.rb 1 gives me "" "AB" with ruby 1.7.1 (cvs 12 June) to add even more complexity :-P +--- Kero ------------------------------ kero@chello.nl ---+ | Don't split your mentality without thinking twice | | Proud like a God -- Guano Apes | +--- M38c ------------------ http://huizen.dds.nl/~kero ---+