Hello,
Is it possible to change the -setter command associated with a parameter at some point other than class definition? I want to trigger some side effects from a parameter set operation, but I can't trigger the side effects until after other things have been initialized, so I want to use the default setter method until the end of init, and then replace the setter method (but not the getter method).
I can override create a parameter-named method at init time, but that overrides the getter along with the setter. I'd rather not have to handle the -getter from my proc (the default -getter is fine and 2.5x faster). I've looked through the docs and the tutorial and I can get tantalizingly close (parametercmd), but is there an easy way from within a proc to change the -setter properties of a parameter?
Something like this:
Class create a -parameter {{foo 1}}
a instproc foosetter {var val} {
# Do something with [self] that isn't valid pre-init
}
a instproc init {} {
#override foo's -setter parameter cmd
my parametercmd foo -setter foosetter
}
a create b -foo 234 ;# calls default foo setter
b foo ;# calls default foo getter
b foo 123 ;# calls overridden foosetter
Thanks for your help. XOTcl is a great. It should be adopted as Tcl's standard OO package.
Scott