Menu

#324 Instance method 'new' missing in metaclass 'Class' ...

3.2.0
closed
Classes (182)
5
2012-08-14
2007-06-03
No

The metaclass 'Class' does not list the method 'new', although all class objects (instances of 'Class') in the system must possess (and do possess) that very method in order to be able to create instances of the class they represent.

[From the current classifcation tree it is not possible for instances of 'Class' to inherit the method 'new' from the superclass 'Object', as 'new' is not defined to be an instance method there.]

Discussion

  • Rick McGuire

    Rick McGuire - 2007-06-04

    Logged In: YES
    user_id=1125291
    Originator: NO

    I need more information on what you are talking about here. .Class most certainly does have a NEW instance method. Please attach an example showing the failure.

     
  • Rony G. Flatscher

    Logged In: YES
    user_id=662126
    Originator: YES

    Sending the message "methods" to ".Class", restricting to return only the methods .Class defines does not return "new" in the message supplier. (I see that 'instanceMethods(.Class)' will return a 'new' method.)

    ----------- cut here -----------
    F:\work\svn\oorexx>rexxtry
    REXX-ooRexx_3.2.0(MT) 6.02 2 Jun 2007
    rexxtry.rex lets you interactively try REXX statements.
    Each string is executed when you hit Enter.
    Enter 'call tell' for a description of the features.
    Go on - try a few... Enter 'exit' to end.
    call rgf_util2
    ........................................... rexxtry.rex on WindowsNT
    call dump2 .class~methods(.class)
    type: The Supplier class: (25 items)

    #  1: [!DEFINE_METHODS]        -> [a Method #x2D000144]
    #  2: [!REXXDEFINED]           -> [a Method #x21000044]
    #  3: [<>]                     -> [a Method #x3C000104]
    #  4: [=]                      -> [a Method #x3A000104]
    #  5: [==]                     -> [a Method #x3B000104]
    #  6: [><]                     -> [a Method #x3C000104]
    #  7: [BASECLASS]              -> [a Method #x25000044]
    #  8: [DEFAULTNAME]            -> [a Method #x17000004]
    #  9: [DEFINE]                 -> [a Method #x2C000244]
    # 10: [DELETE]                 -> [a Method #x2E000144]
    # 11: [ENHANCED]               -> [a Method #x34007F04]
    # 12: [ID]                     -> [a Method #x24000004]
    # 13: [INHERIT]                -> [a Method #x32000204]
    # 14: [ISSUBCLASSOF]           -> [a Method #x3D000104]
    # 15: [METACLASS]              -> [a Method #x26000044]
    # 16: [METHOD]                 -> [a Method #x2F000104]
    # 17: [METHODS]                -> [a Method #x30000104]
    # 18: [MIXINCLASS]             -> [a Method #x35000304]
    # 19: [QUERYMIXINCLASS]        -> [a Method #x23000004]
    # 20: [SUBCLASS]               -> [a Method #x36000304]
    # 21: [SUBCLASSES]             -> [a Method #x2A000044]
    # 22: [SUPERCLASSES]           -> [a Method #x29000044]
    # 23: [UNINHERIT]              -> [a Method #x33000144]
    # 24: [\=]                     -> [a Method #x3C000104]
    # 25: [\==]                    -> [a Method #x3C000104]
    

    ........................................... rexxtry.rex on WindowsNT
    ----------- cut here -----------

     
  • Rick McGuire

    Rick McGuire - 2007-06-04

    Logged In: YES
    user_id=1125291
    Originator: NO

    The "new" method cannot be part of the instance methods of a class created by .Class~new, as it would conflict with the "new" method used to create class instances. A meta class is used as a template for creating new classes, which at some level involves some hand construction. The instance methods of the meta class are all of the standard inheritable of class. The "new" method is then merged in based on the hierarchy of the used to construct the class. This "new" method is one used to create instances of the class, not the "new" method from .Class. To pick up the .Class "new" method, you need to subclass .Class, not create a new one via new.

     

Anonymous
Anonymous

Add attachments
Cancel