Posted to tcl by hypnotoad at Tue Jan 08 15:26:54 GMT 2019view pretty
### # Build on a class that has been created in C # # C defines the following: # Configure_Dump - Return a dict of the current state # Configure_Get - Return a single value from the current state # Configure_Set - Set a new value for the current state # Configure_Delta - Return a list of all of the values that have a script # binding and were modified since the last call to Configure_Delta ### oo::define oo::class { method configure args { if {[llength $args]==0} { tailcall my Configure_Dump } if {[llength $args]==1} { tailcall my Configure_Get [lindex $args 0] } foreach {key value} $args { my Configure_Set $key $value } foreach {key value script} [my Configure_Delta] { eval [string map [list %field% $field %value% $value %self% [self]] $script] } } method cget field { tailcall my Configure_Get $field } }