Ilias said:
[EVALUATION] - E03d - The Ruby Object Model (End Game)
http://groups-beta.google.com/group/comp.lang.ruby/msg/ea9da543dc256b42
-
The above thread has led to this code:
class Class
def Meta()
@Meta ||= (class<<self;self;end)
end
end
which is modified here to:
class Object
def sso()
@sso ||= (class<<self;self;end) # see code below
end
end
simplified:
def sso()
unless @sso
@sso = (class<<self; self; end) #
end
@sso
end
-
sso = Specializing Singleton Object
-
The sso contains definitions (methods, attributes, constants) which
specialize the behaviour of its carrying object.
The "sso" of a "class object" is used to specialize the behaviour of the
class (against Class).
-
The sso's are essentially internal implementation details, although they
are accessible (see code above).
The sso's are _not_ part of the Ruby Object Model (e.g. inheritance
hierarchy).
-
-
-
As stated before, the following documentation is false:
cmd:> ri Class
"Classes, modules, and objects are interrelated. In the diagram that
follows, the arrows represent inheritance, and the parentheses
meta-classes. All metaclasses are instances of the class `Class'."
+------------------+
| |
Object---->(Object) |
^ ^ ^ ^ |
| | | | |
| | +-----+ +---------+ |
| | | | |
| +-----------+ | |
| | | | |
+------+ | Module--->(Module) |
| | ^ ^ |
OtherClass-->(OtherClass) | | |
| | |
Class---->(Class) |
^ |
| |
+----------------+
-
a) The term "meta-classes" is false.
confirmed by: Mr. Matsumoto:
"In Ruby, the Class class is the class of all classes, no metaclass."
http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-talk/40537
-
confirmed by: the general-validity term "metaclass".
[Mr. Matsumoto was unwilling to answer directly to the root-message]
Correction: "specializing-singleton-objects"
or possibly: xclass = eXclusive-class
or singleton class.
but _not_ metaclass.
this is _false_ and completely _missleading_.
b) vertical arrows do not represent inheritance
e.g.: Object---->(Object)
Correction: Object-----(Object)
confirmed by Mr. Matsumoto within this thread:
"And I will add a word "vertical" before "arrow" for
the next check in, anyway."
[Mr. Matsumoto was unwilling to answer directly to the root-message]
c) the classes in "()" do not belong to the object model
Correction: remove (showcase sso in seperate topic)
No confirmation.
Seeing the egoism-loaded community, it should take around 1 to 3 further
years to clarify this issue.
My final questions are basicly:
* Ruby is OO. Why is the sso not directly accessible?
"considered abuse" by the language designer Mr. Matsumoto
http://www.ruby-talk.org/cgi-bin/scat.rb/ruby/ruby-talk/40548
Of course this is irrational, as there is a "singleton-class-notation"
available, which makes the object accessible anyway.
class << <object>
No need to refuse a convenience method.
Except: Rubyist are sheeps, which must be protected from doing damage.
* Who has written the "ri Class" documentation?
from within this thread:
Mr. Matsumoto has drawn the diagramm.
Mr. Matsumoto has provided the confusion with the term "metaclass", most
possibly as he was/is confused/unclear about the theory/implementation:
ruby source-code, file "object.c"
"
void
Init_Object()
{
VALUE metaclass;
rb_cObject = boot_defclass("Object", 0);
rb_cModule = boot_defclass("Module", rb_cObject);
rb_cClass = boot_defclass("Class", rb_cModule);
metaclass = rb_make_metaclass(rb_cObject, rb_cClass);
metaclass = rb_make_metaclass(rb_cModule, metaclass);
metaclass = rb_make_metaclass(rb_cClass, metaclass);
"
vs.
"In Ruby, the Class class is the class of all classes, no metaclass."
http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-talk/40537
..
* Can I expect an apology for this false documentation?
It looks like this community lacks any strong personalities.
I can neither expect an apology from the responsile person, Mr.
Matsumoto, nor an open, egoism-free analysis of the problem domain from
the community.
-
Many people from the community are not ashamed to used the discussion
i've initialized to understand (partly within other threads), without
saying: "hey, thank you for raising this issue. this is positive for
ruby's evolution"
time to close this thread.
_such_ a waste of time.
..