Rick
That's *exactly* what I was looking for ! Now I have to read that at least
10 times to make it enter in my mind :-). But that will help greatly to read
the code.
Jean-Louis
2011/8/8 Rick McGuire <object.r...@gmail.com>
> A metaclass has one very important distinction: The NEW method of a
> metaclass MUST return a class object, not some other sort of object.
> It is a factory for making class objects used to build new classes.
>
> The processing goes something like this:
>
> 1) Send a NEW message to the metaclass to create a new class object
> instance. This object will implement some number of methods directly
> just be virtue of being an object. These are the class object's
> instance methods, but since it is a class object, they are frequently
> referred to as "class" methods. It also has an internal dictionary
> which are the methods that will be given to its instances when they
> are created. These are the methods that are frequently referred to as
> "instance" methods. Typically, the metaclass is just the Class class.
>
> 2) Give the two dictionaries above (I'll refer to them as the class
> method dictionary and the instance method dictionary from here on), a
> merging process then takes place to create the new class object. Each
> of these dictionaries are merged with the following:
>
> a) The class and instance method dictionaries from the superclass.
> b) The class and instance method dictionaries from each of the
> inherited mixin classes
> c) The additional methods defined by the directories. The
> methods tagged with the CLASS keyword are added to the class
> dictionary, the "regular" methods are added to the instance
> dictionary.
>
> A lot of the metaclass processing was driven by the since removed SOM
> support. On an import, a SOM metaclass object was used to retrieve
> the methods associated with the imported SOM class. I believe that
> the SOM support was the reason the metaclasses array exists. I think
> the SOM object model allowed for multiple metaclasses. It has been a
> long time and I never was directly involved with the SOM support in
> the first place.
>
> Contrary to Rony's assertions, I was not the original implementer of
> this particular bit of code. One of the few portions of the runtime
> where this isn't the case. I generally find I have to carefully read
> through what's going on every time I need to touch that area, and
> there are a few things I found a bit strange about it, but have not
> had a good reason to do a major cleanup pass, particularly since this
> is an area that has tended to be pretty sensitive to changes.
>
> Rick
>
> On Mon, Aug 8, 2011 at 10:35 AM, Rony G. Flatscher
> <rony.flatsc...@wu-wien.ac.at> wrote:
> > Hi Jean-Louis,
> >
> > totally overlooked your original questions related to the reference
> > documentations:
> >
> > On 08.08.2011 10:23, Jean-Louis Faucher wrote:
> >
> > I can't find a suitable definition for the ??? below.
> >
> > Extracted from rexxref :
> >
> > 5.1.1
> > The Object class is the root of the class hierarchy.
> > The instance methods of the Object class are, therefore, available on all
> > objects.
> > [JLF] The class methods of the Object class are ???
> >
> > All methods of the class "Class": "=", "\=", "==", "\==", "<>", "><",
> > "baseClass", "defaultName", "define", "delete", "enhanced", "hashcode",
> > "id", "inherit", "isSubclassOf", "metaClass", "method", "methods",
> > "mixinClass", "new", "queryMixinClass", "subClass", "subClasses",
> > "superClass", "superClasses", "uninherit".
> >
> > Plus all methods of the root class "Object" via inheritance.
> >
> > 5.1.2
> > The Class class is like a factory that produces the factories that
> produce
> > objects. It is a subclass of the
> > Object class.
> > The instance methods of the Class class are also the class methods of all
> > classes.
> > [JLF] The class methods of the Class class are ???
> >
> > All methods of the class "Class": "=", "\=", "==", "\==", "<>", "><",
> > "baseClass", "defaultName", "define", "delete", "enhanced", "hashcode",
> > "id", "inherit", "isSubclassOf", "metaClass", "method", "methods",
> > "mixinClass", "new", "queryMixinClass", "subClass", "subClasses",
> > "superClass", "superClasses", "uninherit".
> >
> > Plus all methods of the root class "Object" via inheritance.
> >
> > 4.1.4
> > A metaclass is a class you can use to create another class. The only
> > metaclass that Rexx provides is .Class, the Class class. The Class class
> is
> > the metaclass of all the classes Rexx provides. This means that instances
> of
> > .Class are themselves classes.
> > [JLF] The instance methods of a metaclass are ??? : [proposition] the
> class
> > methods of all the classes associated to this metaclass.
> >
> > All methods of the class "Class": "=", "\=", "==", "\==", "<>", "><",
> > "baseClass", "defaultName", "define", "delete", "enhanced", "hashcode",
> > "id", "inherit", "isSubclassOf", "metaClass", "method", "methods",
> > "mixinClass", "new", "queryMixinClass", "subClass", "subClasses",
> > "superClass", "superClasses", "uninherit".
> >
> > Plus all methods of the root class "Object" via inheritance.
> >
> > ---
> >
> > If you think about a metaclass you defined yourself, that needs to be a
> > subclass of .Class, then:
> >
> > All methods you defined.
> >
> > Plus all methods of all superclasses, among them all instance methods of
> the
> > class "Class" via inheritance: "=", "\=", "==", "\==", "<>", "><",
> > "baseClass", "defaultName", "define", "delete", "enhanced", "hashcode",
> > "id", "inherit", "isSubclassOf", "metaClass", "method", "methods",
> > "mixinClass", "new", "queryMixinClass", "subClass", "subClasses",
> > "superClass", "superClasses", "uninherit".
> >
> > Plus all methods of the root class "Object" via inheritance.
> >
> > [JLF] The class methods of a metaclass are ???
> >
> > All methods of the class "Class": "=", "\=", "==", "\==", "<>", "><",
> > "baseClass", "defaultName", "define", "delete", "enhanced", "hashcode",
> > "id", "inherit", "isSubclassOf", "metaClass", "method", "methods",
> > "mixinClass", "new", "queryMixinClass", "subClass", "subClasses",
> > "superClass", "superClasses", "uninherit".
> >
> > Plus all methods of the root class "Object" via inheritance.
> >
> > ---
> >
> > If you think about a metaclass you defined yourself, that needs to be a
> > subclass of .Class, then:
> >
> > All methods you defined with the subkeyword "class".
> >
> > Plus all class methods of all superclasses, among them all methods of the
> > class "Class" via inheritance: "=", "\=", "==", "\==", "<>", "><",
> > "baseClass", "defaultName", "define", "delete", "enhanced", "hashcode",
> > "id", "inherit", "isSubclassOf", "metaClass", "method", "methods",
> > "mixinClass", "new", "queryMixinClass", "subClass", "subClasses",
> > "superClass", "superClasses", "uninherit".
> >
> > Plus all methods of the root class "Object" via inheritance.
> >
> > ---
> >
> > You could look at the methods interactively, e.g. with "rgf_util2.rgf" in
> > rexxtry sessions resp. your shell:
> >
> > call "rgf_util2.rex"
> > call dump2 .class~methods -- lists all methods defined for instances of
> the
> > class "Class", includes inherited methods
> > call dump2 .class~methods(.class) -- lists all methods defined for
> instances
> > of the class "Class" only
> > call dump2 .class~methods(.object) -- lists all methods defined for
> > instances of the class "Object" only
> > call dump2 .class~instanceMethods -- lists all instance methods defined
> for
> > the class "Class", includes inherited methods
> > call dump2 .class~instanceMethods(.class) -- lists all instance methods
> > defined for the class "Class" only
> > call dump2 .class~instanceMethods(.object) -- lists all instance methods
> > defined for the class "Object" only
> > ...
> >
> > If you then compare the methods for the "Class" class object with those
> that
> > instances of that class will get, you will notice that the "Class" class
> > object instance has the method "NEW" in addition. (It is missing from the
> > "Class" methods collection of methods to give to instances. It seems that
> > the "NEW" method gets added via setMethod while the class objects get
> > created.)
> >
> > Not sure, why this got implemented this way, but Rick would know.
> >
> > ---
> >
> > Also a final remark ad metaclasses: as they are normal ooRexx classes it
> is
> > possible to employ multiple inheritance among metaclasses which opens a
> lot
> > of interesting and powerful problem solution capabilities!
> >
> > E.g. you could create a metaclass for the singleton pattern, another one
> to
> > server as a counter or a manager of created instances and later combine
> the
> > functionality of such metaclasses through multiple inheritance, which is
> > simply great!
> >
> > HTH,
> >
> > ---rony
> >
> >
> >
> >
> ------------------------------------------------------------------------------
> > BlackBerry® DevCon Americas, Oct. 18-20, San Francisco, CA
> > The must-attend event for mobile developers. Connect with experts.
> > Get tools for creating Super Apps. See the latest technologies.
> > Sessions, hands-on labs, demos & much more. Register early & save!
> > http://p.sf.net/sfu/rim-blackberry-1
> > _______________________________________________
> > Oorexx-devel mailing list
> > Oorexx-devel@lists.sourceforge.net
> > https://lists.sourceforge.net/lists/listinfo/oorexx-devel
> >
> >
>
>
> ------------------------------------------------------------------------------
> BlackBerry® DevCon Americas, Oct. 18-20, San Francisco, CA
> The must-attend event for mobile developers. Connect with experts.
> Get tools for creating Super Apps. See the latest technologies.
> Sessions, hands-on labs, demos & much more. Register early & save!
> http://p.sf.net/sfu/rim-blackberry-1
> _______________________________________________
> Oorexx-devel mailing list
> Oorexx-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/oorexx-devel
>
------------------------------------------------------------------------------
BlackBerry® DevCon Americas, Oct. 18-20, San Francisco, CA
The must-attend event for mobile developers. Connect with experts.
Get tools for creating Super Apps. See the latest technologies.
Sessions, hands-on labs, demos & much more. Register early & save!
http://p.sf.net/sfu/rim-blackberry-1
_______________________________________________
Oorexx-devel mailing list
Oorexx-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/oorexx-devel