---1077017559-1369306703-11143087157107 Content-Type: MULTIPART/MIXED; BOUNDARY="-1077017559-1369306703-1114308715=:17107" This message is in MIME format. The first part should be readable text, while the remaining parts are likely unreadable without MIME-aware tools. ---1077017559-1369306703-11143087157107 Content-Type: TEXT/PLAIN; CHARSET=ISO-8859-1; format=flowed Content-Transfer-Encoding: QUOTED-PRINTABLE Content-ID: <Pine.LNX.4.61.0504232212071.17107 / ns.artengine.ca> On Wed, 20 Apr 2005, Jim Weirich wrote: > It also makes the name "Singleton" class a little odd. I thought it was > because a singleton class could only have a single instance. Now I find out > it can't even have that. Perhaps they should be Zeroton classes :) The instance-of relationship is not about creatability of new objects: it is about which object represents the behaviour of which other object, period. In the case of singleton classes, the instance is created *before* the class is, and it doesn't follow that this peculiar creation order makes that relationship a lesser-instance-of or a non-instance-of. Where the "singleton" name really breaks is with indirect instance-of relationships: for example, (Object) has many indirect instance-of relationships, with *all* Ruby classes in the system, and you can instantiate the (Object) class as many times as you want to, and you always do whenever you are subclassing any class whatsoever, because every instance of Class is also an instance of (Object). (note: the general instance-of such as Module#=== is transitive in the sense that it also includes instance-of-subclass-of and so on: every object is an instance-of Object.) > The formal definition does not require metaclasses (or classes) to create > instances ... only that they /have/ instances (which is you so clearly > demonstrated singleton classes have no instances). I have trouble following that... we seem to both agree and disagree on the same thing at once...! Maybe it's because of confusing the Object#class method with which is the direct-instance-of relationship of an object. The latter cannot be observed in Ruby: if an object x has no S-class, then it's directly-instance-of the result of x.class, and if an object has a S-class, it's directly-instance-of the result of (class<<x;self;end) and not of x.class, but there's no way to figure out whether an object has an S-class other than to cause that S-class to spring into existence (!). Does this all make sense to you? ,-o---------o---------o---------o-. ,----. | | The Diagram is the Program (TM) | | ,-o----------------------------o-. `-o-----------------------------o-' | | Mathieu Bouchard (MontrñÂl QC)---' | http://artengine.ca/matju | | | `-o------------------------------' ---1077017559-1369306703-11143087157107-- ---1077017559-1369306703-11143087157107--