• tcloo howto call a superclass "new" ?

    From aotto1968@aotto1968@t-online.de to comp.lang.tcl on Tue Apr 9 12:34:12 2024
    From Newsgroup: comp.lang.tcl


    Hi, I use tcl8.6.12 and the "superclass new" is not called → why

    oo::class create MkObjectRpc {
    superclass oo::class
    # root
    variable hdl
    }

    oo::class create Sq3LiteRpc {
    superclass MkObjectRpc
    variable hdl
    }


    # superclass "new"
    oo::define MkObjectRpc self method new { rpc args } {
    CUM
    set cls [self class]
    # call: Sq3Litenew
    if {[lindex $args 0] eq {-hdl}} {
    set mqHdl [lindex $args 1]
    } else {
    set mqHdl [[info obj namespace $cls]::my CTOR $rpc {*}$args]
    }
    next $rpc $mqHdl
    }

    # class "new"
    oo::define Sq3LiteRpc self method new { rpc args } {
    CUM
    cmd self call
    # call: Sq3Litenew
    next $rpc {*}$args → expect to call "MkObjectRpc self method new"
    }


    test:


    Sq3LiteRpc new $rpc :memory:

    "Sq3LiteRpc self method new" is called → OK

    :Sq3LiteRpc::new -> CUM -> rpc<::oo::Obj41> , args<:memory:>
    [self call] = {{method new object method} {method new ::oo::class {core method: "new"}}} 0

    BUT !! " MkObjectRpc self method new" is NOT called ?? → why ?


    the same code with: "nextto MkObjectRpc $rpc {*}$args" in "Sq3LiteRpc self method new" create

    method has no non-filter implementation by "MkObjectRpc"
    while executing
    "nextto MkObjectRpc $rpc {*}$args"
    (object "::Sq3LiteRpc" method "new" line 5)
    invoked from within
    "Sq3LiteRpc new $FH($F) :memory: "
    ("uplevel" body line 1)
    invoked from within
    "uplevel 1 $script"


    mfg ao.
    --- Synchronet 3.20a-Linux NewsLink 1.114