View · Search · Index
No registered users in community xowiki
in last 10 minutes

[Xotcl] Dynamic class change question

From: Murr, Florian <florian.murr_at_siemens.com>
Date: Wed, 1 Mar 2006 09:02:20 +0100

In XOTcl (1.3.8) there seems to be no initialisation of parameters
during dynamic class change.
See code below: a1 and a2 behave differently.

Is this the intended behaviour?

- regards, Florian



package require XOTcl
namespace import xotcl::*
eval [string map {INFO {[self] [info level 0] : [my info class] : [my
info vars]}} {
    Class A -parameter {
        {p 0}
    }
    A instproc pp {} { puts "A INFO"; next }
    
    
    Class B -superclass A -parameter {
        {q 0}
    }
    B instproc pp {} { puts "B INFO"; next }
}]

proc main {} {
    set strich
"--------------------------------------------------------------"

    puts $strich
    A create a1 -p a1
    a1 class B
    #a1 init
    a1 pp
    #puts "a1 q = [a1 q]" ;# should this be an error?

    puts $strich

    A create a2 -p a2
    a2 class B
    a2 q xx
    a2 pp
    #puts "a2 q = [a2 q]"
    puts $strich
}
main