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

[Xotcl] 'assign' method of properties not called on object initialization

From: Arthur Schreiber <schreiber.arthur_at_googlemail.com>
Date: Thu, 26 Jan 2012 12:06:42 +0100

Hi everyone,

When assigning an object's property using object parameters, the assign
method of that property does not get called. Is that a bug or intended
behaviour?

See the following code:

package require nx

nx::Class create Foo {
    :property bar {
        :public method assign { object property value } {
            puts "assign called for: $object $property $value"
        }
    }
}

set foo [Foo new]
$foo bar "test"; # assign method of the bar property is called

Foo new -bar "test"; # assign method of the bar property is _not_ called

Kind regards,
Arthur