#127 Add an "instanceof" capability to the .object class.

Next_Release
closed
David Ashley
Classes (154)
5
2012-08-14
2007-03-18
Rick McGuire
No

Validity checking frequently requires that a test for a certain type of object be made. Tests directly on the class name only work if this is not a subclass or the test class is not a mixin class.

Discussion

  • Rick McGuire
    Rick McGuire
    2007-03-18

    Logged In: YES
    user_id=1125291
    Originator: YES

    David,

    The following method needs to be added to the Object class:

    ISINSTANCEOF(class)

    Returns true ("1") if the object is an instance of the requested class. Returns false ("0") if the object is not an instance of the requested class. An object is an instance of a class is the object is directly an instance of the class or if the class is in the object's direct or mixin class inheritance chain. For example,

    "abc"~isinstanceof(.string)   -- returns true
    "abc"~isinstanceof(.object)   -- also returns true
    
     
  • David Ashley
    David Ashley
    2007-03-19

    Logged In: YES
    user_id=931756
    Originator: NO

    Added to the docs with SVN revision 172.

     


Anonymous


Cancel   Add attachments