Index: TODO =================================================================== diff -u -N -r5cd6585d0df39ac72dba70e8facd60e491ba7718 -r71015d43732133b53eed552468a6e408d43415eb --- TODO (.../TODO) (revision 5cd6585d0df39ac72dba70e8facd60e491ba7718) +++ TODO (.../TODO) (revision 71015d43732133b53eed552468a6e408d43415eb) @@ -5013,6 +5013,12 @@ - simplify SuperclassAdd() - improve code documentation +nx.tcl: +- Define method "value" as a slot forwarder to allow for calling + value-less slot methods like e.g. "get" dispite of the arity-based + forward dispatcher. +- extend regression test + ======================================================================== TODO: Index: library/nx/nx.tcl =================================================================== diff -u -N -rcaba76f5ac2943f5a3dfd33550cb578132f40c80 -r71015d43732133b53eed552468a6e408d43415eb --- library/nx/nx.tcl (.../nx.tcl) (revision caba76f5ac2943f5a3dfd33550cb578132f40c80) +++ library/nx/nx.tcl (.../nx.tcl) (revision 71015d43732133b53eed552468a6e408d43415eb) @@ -1194,6 +1194,19 @@ createBootstrapVariableSlots ::nx::Slot { } + # Define method "value" as a slot forwarder to allow for calling + # value-less slot methods like e.g. "get" dispite of the arity-based + # forward dispatcher. + ::nx::Slot public method value {obj method prop value:optional pos:optional} { + if {[info exists pos]} { + ${:manager} $prop $obj ${:name} $value $pos + } elseif {[info exists value]} { + ${:manager} $prop $obj ${:name} $value + } else { + ${:manager} $prop $obj ${:name} + } + } + ###################################################################### # configure nx::ObjectParameterSlot ###################################################################### @@ -1306,6 +1319,7 @@ set name ${:name} set domain ${:domain} } + ::nsf::method::forward $domain \ {*}[expr {${:per-object} ? "-per-object" : ""}] \ $name \ Index: tests/properties.test =================================================================== diff -u -N -rf34ac86da9500e115e9bbd5e638b055d64896925 -r71015d43732133b53eed552468a6e408d43415eb --- tests/properties.test (.../properties.test) (revision f34ac86da9500e115e9bbd5e638b055d64896925) +++ tests/properties.test (.../properties.test) (revision 71015d43732133b53eed552468a6e408d43415eb) @@ -674,7 +674,28 @@ } +# +# Tests for experimental "value add", "value assign" ... +# +nx::test case property-value-incremental { + + nx::Object create o1 { + :object property -incremental {a a1} + } + + ? {o1 a add x} {x a1} + ? {o1 a {a1}} {a1} + + nsf::configure debug 2 + ? {o1 a value add x } {x a1} + ? {o1 a value assign {a b c}} {a b c} + ? {o1 a value get } {a b c} + ? {o1 a value add x } {x a b c} + ? {o1 a value add z end} {x a b c z} +} + + ##################################################################### # tests with class object #####################################################################