Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

#3 Add methods \\\"methods\\\" and \\\"method\\\" to root class \\\"Object\\\"

v3.2.0
closed
David Ashley
Classes (154)
5
2012-08-14
2004-11-14
No

In Object Rexx one-off objects are possible, and
objects may gain/lose individually methods.

In order to access them the methods "METHODS"
(enumerating the individual object's methods) and
"METHOD" (returning an indicated method object) are
necessary to be defined in the root class "Object".

These two suggested methods should convey the same
semantics as the methods with the same name in the
class "Class".

Discussion

  • Rick McGuire
    Rick McGuire
    2005-01-20

    Logged In: YES
    user_id=1125291

    This feature is not of highest importance criticality.

     
  • Logged In: YES
    user_id=662126
    Originator: YES

    There is another, more important use-case: when trying to find out all of the class methods of a class object at runtime, this is not possible at the moment.

    The reason: the class object's methods (usually those that are defined for the metaclass .Class) are sometimes enhanced by the class methods defined for a class, without being reflected in the .Class object's methods collection. (Such class methods seem to be attached to the class object using setmethod).

    E.g. it is not possible to get at the information that the following class defines the class methods "INIT" and "someDebugMethod" on its own:

    -------------------- cut here ----------------
    ::class rgfTest1 subclass Class
    ::method init class
    say "a specialized init method for the class object"
    forward class (super) -- run .Class' constructor

    ::method someDebugMethod class
    say "a class method, which exists only for this class"
    -------------------- cut here ----------------

    I would like to create among other things, a utility which will use reflection to query all class and instance methods a class defines. One actual and needed application would then be used to get snapshots about the instance and class methods defined for ooRexx classes for creating test-tables and (for the future) being able to find out which classes and methods were added between releases.

    BTW, I wrote an program ("show_classes.rex") almost 8 (EIGHT !) years ago, which lists (alphabetically sorted) the instance and class methods the classes in the running set define, in addition a cross-reference is created. [It has a switch where you can supply a program, which will execute, and afterwards will only show all classes that got defined by running that program with all the instance and class methods these classes define.] Because this utility is not able to get at the class methods at all (only at those defined for .Class), I have not been able to releas it to the public, as the utility would unfortunately generate wrong (incomplete) results.

    Therefore I kindly request to add these two methods to .Object! If possible at all, already for the refresh which would help creating automated test-plans.


    There are two issues relating to this RFE (id # 1066313 and # 1105891):

    http://sourceforge.net/tracker/index.php?func=detail&aid=1066313&group_id=119701&atid=684733

    and

    http://sourceforge.net/tracker/index.php?func=detail&aid=1105891&group_id=119701&atid=684733

    Regards,

    ---rony

     
  • Rick McGuire
    Rick McGuire
    2007-04-05

    Logged In: YES
    user_id=1125291
    Originator: NO

    I'm starting to take a look at this, and the only snag is the choice of names. These should not be called METHODS and METHOD, since that would mean you can't do the same sort of reflective inspection on CLASS object instances. Perhaps ObjectMethod or InstanceMethod? I can start working on the code now, but I won't check this in until there's some sort of consensus on the name.

     
  • Logged In: YES
    user_id=662126
    Originator: YES

    Indeed, reflecting CLASS object instances was the original motivation to ask for that!

    Either name sounds fine, maybe InstanceMethod carries the concrete meaning a little bit better?

     
  • Rick McGuire
    Rick McGuire
    2007-04-05

    Logged In: YES
    user_id=1125291
    Originator: NO

    This is going to need some doc changes also.

     


Anonymous


Cancel   Add attachments