• tcloo how to call a hidden method

    From aotto1968@21:1/5 to All on Sat Aug 27 13:52:29 2022
    Hi,

    a method from the parent-class can be hidden by current-class,. The problem is to
    call a "hidden" method from outside (not from class-body)

    → to call a "hidden" method from class-body the "next" command is used but I want to call the method from outside

    example:

    $obj ToNameOfClass ; # call the latest "ToNameOfClass", but this is *not* wanted
    $obj next ToNameOfClass ; # this is what I want, but this is *not* supported

    In a traditional OO language the "obj" will be *cast* into the parent-class-instance and the
    method will be called from this cast, but TCL has no cast etc

    pseudocode:
    set parent [$obj cast-to-parent]
    $parent ToNameOfClass

    BUT I like the *next* syntax better

    parent: $obj next method
    parent of parent: $obj next next method → etc


    question: how can I call a *HIDDEN* method from "outside".


    mfg

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From aotto1968@21:1/5 to All on Sat Aug 27 14:45:09 2022
    On 27.08.22 13:52, aotto1968 wrote:
    Hi,

    a method from the parent-class can be hidden by current-class,. The problem is to
    call a "hidden" method from outside (not from class-body)

    → to call a "hidden" method from class-body the "next" command is used but I want to call the method from outside

    example:

    $obj ToNameOfClass         ; # call the latest "ToNameOfClass", but this is *not* wanted
    $obj next ToNameOfClass        ; # this is what I want, but this is *not* supported

    In a traditional OO language the "obj" will be *cast* into the parent-class-instance and the
    method will be called from this cast, but TCL has no cast etc

    pseudocode:
    set parent [$obj cast-to-parent]
    $parent ToNameOfClass

    BUT I like the *next* syntax better

    parent:         $obj next method
    parent of parent:     $obj next next method → etc


    question: how can I call a *HIDDEN* method from "outside".


    mfg


    addition.

    In python all methods are static and a instance-method is a method with the *self* as *first* parameter

    A possible call to a instance-method from the parent-class:

    → MkObjectC ToNameOfClass $obj

    or more general

    → class method $instance

    or as example

    $obj method ... (call the latest implementation of the method)
    class method $obj (call the implementation if the method provided by "class")

    This should be possible to call a *specific* implementation (in this case the MkObjectC implementation) of the "ToNameOfClass"
    method

    mfg

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)