Index: library/nx/nx.tcl =================================================================== diff -u -r371cc41c32db500cb1d5bcab139ef65299ef4d6c -r7bcc1f1a88422c472cbeb238c1d7d1a337361bc8 --- library/nx/nx.tcl (.../nx.tcl) (revision 371cc41c32db500cb1d5bcab139ef65299ef4d6c) +++ library/nx/nx.tcl (.../nx.tcl) (revision 7bcc1f1a88422c472cbeb238c1d7d1a337361bc8) @@ -2238,6 +2238,11 @@ if {![info exists trace] && [info exists :trace] && ${:trace} ne "none"} { set trace ${:trace} } + + if {$parameterOptions ne "" && "substdefault" in [split $parameterOptions ,]} { + set defaultValue [subst $defaultValue] + } + if {$initblock eq "" && !$configurable && !$incremental && $accessor eq "none" && ![info exists trace]} { # @@ -2257,7 +2262,7 @@ # we rely here that the nsf::is error message expresses the implementation limits set noptions {} foreach o [split $parameterOptions ,] { - if {$o ne "noconfig"} {lappend noptions $o} + if {$o ni {noconfig substdefault}} {lappend noptions $o} } set parameterOptions [join $noptions ,] Index: tests/parameters.test =================================================================== diff -u -re0da9e0032a357fe5c6bfdd37a2d234e00780460 -r7bcc1f1a88422c472cbeb238c1d7d1a337361bc8 --- tests/parameters.test (.../parameters.test) (revision e0da9e0032a357fe5c6bfdd37a2d234e00780460) +++ tests/parameters.test (.../parameters.test) (revision 7bcc1f1a88422c472cbeb238c1d7d1a337361bc8) @@ -919,9 +919,9 @@ } ####################################################### -# testing substdefault for object parameters +# testing substdefault for object parameters (per-class) ####################################################### -nx::test case substdefault-objparam { +nx::test case substdefault-objparam-perclass { nx::Class create Bar { @@ -945,6 +945,49 @@ ? {b cget -s3} "::b" } +####################################################### +# testing substdefault for object parameters (per-object) +####################################################### +nx::test case substdefault-objparam-perobj { + + nx::Object create rab { + + # no substdefault given + :object property {s0 "[current]"} + + # explicit substdefault + :object property {s1:substdefault "[current]"} + + # unneeded double substdefault + :object property {s2:substdefault,substdefault "[current]"} + + # substdefault with incremental + :object property -incremental {s3:substdefault "[current]"} + + # no substdefault given + :object variable s4 {[current]} + + # explicit substdefault + :object variable s5:substdefault {[current]} + + # unneeded double substdefault + :object variable s6:substdefault,substdefault {[current]} + + # substdefault with incremental + :object variable -incremental s7:substdefault {[current]} + } + + ? {rab cget -s0} {[current]} + ? {rab cget -s1} "::rab" + ? {rab cget -s2} "::rab" + ? {rab cget -s3} "::rab" + ? {rab eval {set :s4}} {[current]} + ? {rab eval {set :s5}} "::rab" + ? {rab eval {set :s6}} "::rab" + ? {rab eval {set :s7}} "::rab" +} + + # # Test call of configure within constructor #