Index: library/nx/nx.tcl =================================================================== diff -u -rbabe6447be02524ff70f5af3ee83ae5aa678b6d1 -red365a90fa455e82a281fc1b4bfaa4b96081da12 --- library/nx/nx.tcl (.../nx.tcl) (revision babe6447be02524ff70f5af3ee83ae5aa678b6d1) +++ library/nx/nx.tcl (.../nx.tcl) (revision ed365a90fa455e82a281fc1b4bfaa4b96081da12) @@ -2482,18 +2482,21 @@ } lassign [::nx::MetaSlot parseParameterSpec -class $class -target [self] $spec] \ - pname parameterOptions _ _ + pname parameterOptions _ options - set paramOptsList [split $parameterOptions ,] if {[info exists defaultValue] - && ("substdefault" in $paramOptsList || [lsearch $paramOptsList "substdefault=*"])} { + && [dict exists $options -substdefault] + } { if {[string match {*\[*\]*} $defaultValue]} { if {![info complete $defaultValue]} { return -code error "substdefault: default '$defaultValue' is not a complete script" } } else { - set paramOptsList [lsearch -exact -inline -all -not $paramOptsList "substdefault"] - set spec [string trimright $pname:[join $paramOptsList ,] :] + # + # Rewrite the spec such is has no "substdefault" value + # + #set paramOptsList1 [lsearch -glob -inline -all -not [split $parameterOptions ,] "substdefault*"] + #set spec [string trimright $pname:[join $paramOptsList1 ,] :] } } Index: tests/parameters.test =================================================================== diff -u -rbabe6447be02524ff70f5af3ee83ae5aa678b6d1 -red365a90fa455e82a281fc1b4bfaa4b96081da12 --- tests/parameters.test (.../parameters.test) (revision babe6447be02524ff70f5af3ee83ae5aa678b6d1) +++ tests/parameters.test (.../parameters.test) (revision ed365a90fa455e82a281fc1b4bfaa4b96081da12) @@ -534,26 +534,27 @@ ? {d1 bar -c 1} {::d1-[current]-1-2} "substdefault in method parameter" + set ::X 1001 nx::Class create Bar -superclass D { :property {s:substdefault "[current]"} :property {literal "[current]"} :property {c:substdefault "[:info class]"} :property {d "literal $d"} - :property {e:substdefault "literal $d"} + :property {e:substdefault {noliteral $::X}} } ? {Bar property -accessor public ss:switch} "::nsf::classes::Bar::ss" - Bar create bar1 + ? {Bar create bar1} ::bar1 #puts stderr [bar1 __objectparameter] ? {subst {[bar1 cget -s]-[bar1 cget -literal]-[bar1 cget -c]-[bar1 cget -d]-[bar1 cget -e]}} \ - {::bar1-[current]-::Bar-literal $d-literal $d} \ + {::bar1-[current]-::Bar-literal $d-noliteral 1001} \ "substdefault in object parameter 1" - Bar create bar2 + ? {Bar create bar2} ::bar2 ? {subst {[bar2 cget -s]-[bar2 cget -literal]-[bar2 cget -c]-[bar2 cget -d]-[bar1 cget -e]}} \ - {::bar2-[current]-::Bar-literal $d-literal $d} \ + {::bar2-[current]-::Bar-literal $d-noliteral 1001} \ "substdefault in object parameter 2" # Observation: @@ -3432,8 +3433,8 @@ nx::test case substdefault-hardening { nx::Class create K { - :object property {p2:substdefault "$x"} - :property {p4:substdefault "$y"} + :object property {p2 "$x"} + :property {p4 "$y"} :create k }