Posted to tcl by kap at Sun Aug 09 18:25:50 GMT 2015view pretty

namespace eval foo {

    proc foo {foo} {
        return $foo
    }

    oo::class create bar {

        variable Bar

        constructor {bar} {
            my bar $bar
            # Is there any way to have [my bar] evaluated with
            # Each call of the forward method foo?
            oo::objdefine [self] forward foo foo::foo my bar
        }

        method bar {{bar {}}} {
            if {$bar ne {}} {
                set Bar $bar
            }
            return $Bar
        }
    }
}

foo::bar create a HELLO

# Fails due to the args "my" and "bar" being sent to [foo::foo]
a foo