proc show obj {
     $obj y
    puts [list [$obj y] [lsort [info object vars $obj]] [$obj eval {info vars *!}]]
}

oo::class create foo {
    variable x!
    constructor {} {set x! 1}
    method y {} {incr x!}
}

foo create bar
oo::objdefine bar {
    variable y!
    method y {} {list [next] [incr y!] [info var] [info local]}
    export eval
}
show bar

proc myIncr x {uplevel 1 [list incr $x]}
foo create sum0
oo::objdefine sum0 {
    set name y!
    variable $name
    method y {} {list [next] [myIncr y!] [info var] [info local]}
    export eval
}
show sum0

foo create sum1
set incr incr
oo::objdefine sum1 {
    set name y!
    variable $name
    method y {} {list [next] [$::incr y!] [info var] [info local]}
    export eval
}
show sum1
