Index: TODO =================================================================== diff -u -r67ef5da1e732c50c33f9a3e5769b68ddf18cdaa7 -ra3e419eb3993464990b3f32550892e1bc11124fd --- TODO (.../TODO) (revision 67ef5da1e732c50c33f9a3e5769b68ddf18cdaa7) +++ TODO (.../TODO) (revision a3e419eb3993464990b3f32550892e1bc11124fd) @@ -1253,6 +1253,12 @@ - added handling of parameter options "allowemtpy" and "convert" in createFromParameterSyntax +- renamed slot attribute "noforwarder" to "nosetter" +- method parameter can now use option "nosetter" to allow + object parameterization witout providing a setter method + (example: "Class create C -parameter {x:integer,nosetter}") +- extended regression test to include "nosetter" + TODO: - reflect changes in /is/objectproperty/info has/info is/ in migration guide - implement built-in-converter for "baseclass" and "metaclass"? Index: library/nx/nx.tcl =================================================================== diff -u -r4c4859d357fca9a18892be062cf3de999465e47f -ra3e419eb3993464990b3f32550892e1bc11124fd --- library/nx/nx.tcl (.../nx.tcl) (revision 4c4859d357fca9a18892be062cf3de999465e47f) +++ library/nx/nx.tcl (.../nx.tcl) (revision a3e419eb3993464990b3f32550892e1bc11124fd) @@ -1002,7 +1002,7 @@ set properties [string range $value [expr {$colonPos+1}] end] set name [string range $value 0 [expr {$colonPos -1}]] foreach property [split $properties ,] { - if {$property in [list "required" "multivalued" "allowempty" "convert"]} { + if {$property in [list "required" "multivalued" "allowempty" "convert" "nosetter"]} { lappend opts -$property 1 } elseif {[string match type=* $property]} { set type [string range $property 5 end] @@ -1174,6 +1174,7 @@ {defaultmethods {get assign}} {manager "[::nsf::current object]"} {per-object false} + {nosetter} } # maybe add the following slots at some later time here @@ -1234,7 +1235,7 @@ if {${:per-object} && [info exists :default] } { ::nsf::setvar ${:domain} ${:name} ${:default} } - if {[info exists :noforwarder]} { + if {[info exists :nosetter]} { #puts stderr "Do not register forwarder ${:domain} ${:name}" return } @@ -1379,7 +1380,6 @@ {multivalued true} {type relation} {elementtype ::nx::Class} - {noforwarder} } ::nsf::relation RelationSlot superclass ObjectParameterSlot @@ -1535,8 +1535,8 @@ # Create two conveniance slots to allow configuration of # object-slots for classes via object-mixin - ::nx::RelationSlot create ${os}::Class::slot::object-mixin -noforwarder 1 - ::nx::RelationSlot create ${os}::Class::slot::object-filter -elementtype "" -noforwarder 1 + ::nx::RelationSlot create ${os}::Class::slot::object-mixin -nosetter 1 + ::nx::RelationSlot create ${os}::Class::slot::object-filter -elementtype "" -nosetter 1 # # Define method "guard" for mixin- and filter-slots of Object and Class @@ -1707,8 +1707,9 @@ [list %1 [${:manager} defaultmethods]] %self \ ${:methodname} } - #puts "*** stderr "OPTIMIZER incremental [info exists :incremental] def '[set :defaultmethods]'" + #puts "*** stderr OPTIMIZER incremental [info exists :incremental] def '[set :defaultmethods]' nosetter [info exists :nosetter]" if {[info exists :incremental] && ${:incremental}} return + if {[info exists :nosetter]} return if {[set :defaultmethods] ne {get assign}} return # Index: tests/parameters.tcl =================================================================== diff -u -rb6d81c6521d1e1d58f00763f5ab30a0946cc222a -ra3e419eb3993464990b3f32550892e1bc11124fd --- tests/parameters.tcl (.../parameters.tcl) (revision b6d81c6521d1e1d58f00763f5ab30a0946cc222a) +++ tests/parameters.tcl (.../parameters.tcl) (revision a3e419eb3993464990b3f32550892e1bc11124fd) @@ -1074,6 +1074,8 @@ ? {::nsf::setter o -x} {method name "-x" must not start with a dash} } + + ####################################################### # test for slot-optimizer ####################################################### @@ -1097,7 +1099,17 @@ #slot-optimizer.002: 1.50 mms, c1 b 1 #slot-optimizer.003: 1.60 mms, c1 c 1 } + +Test parameter count 10 +Test case slot-nosetter { + Class create C -parameter {a b:integer,nosetter {c:nosetter ""}} + + ? {C create c1 -a 1 -b 2} ::c1 + ? {c1 info vars} "a b c" + ? {c1 a 100} 100 + ? {c1 b 101} {::c1: unable to dispatch method 'b'} + ? {c1 c 102} {::c1: unable to dispatch method 'c'} +} ## TODO regression test for type checking, parameter options (initcmd, ## substdefault, combinations with defaults, ...), etc. -puts stderr =====END