Index: library/nx/nx.tcl =================================================================== diff -u -r1d1a1be1636a5b6f9ad6e3b5df2a6aa7170b62f0 -rca508a05de8e3783d432b8de2db2ae3e61ae271e --- library/nx/nx.tcl (.../nx.tcl) (revision 1d1a1be1636a5b6f9ad6e3b5df2a6aa7170b62f0) +++ library/nx/nx.tcl (.../nx.tcl) (revision ca508a05de8e3783d432b8de2db2ae3e61ae271e) @@ -817,6 +817,9 @@ set opt(-accessor) 0 } elseif {$property eq "noconfig"} { set opt(-config) 0 + } elseif {$property eq "incremental"} { + set opt(-accessor) 1 + lappend opts -incremental 1 } elseif {[string match type=* $property]} { set class [:requireClass ::nx::VariableSlot $class] set type [string range $property 5 end] @@ -845,6 +848,7 @@ lappend opts -type $type } lappend opts {*}[array get opt] + #puts stderr "[self] *** parseParameterSpec [list $name $parameterOptions $class $opts]" return [list $name $parameterOptions $class $opts] } @@ -1671,7 +1675,6 @@ nx::Object method variable { {-accessor:switch} {-class ""} - {-incremental:switch} {-initblock ""} {-nocomplain:switch} spec:parameter @@ -1683,41 +1686,38 @@ # situations: # - when accessors are needed # (serializer uses slot object to create accessors) - # in general: # - when initblock is non empty # #puts stderr "Object variable $spec accessor $accessor nocomplain $nocomplain" - if {$incremental} { + # get name and list of parameter options + lassign [::nx::MetaSlot parseParameterSpec -class $class $spec] \ + name parameterOptions class options + array set opts $options + + if {[info exists opts(-incremental)]} { # the usage of "-incremental" implies "-accessor" set accessor true - append initblock { - set :incremental 1 - } } if {$initblock eq "" && !$accessor} { # - # build a slot-less variable + # we can build a slot-less variable # - # get name an list of parameter options - lassign [::nx::MetaSlot parseParameterSpec -class $class $spec] \ - name parameterOptions class opts - set isSwitch [regsub {\mswitch\M} $parameterOptions boolean parameterOptions] if {[info exists value]} { if {[info exists :$name] && !$nocomplain} { error "Object [self] has already an instance variable named '$name'" } if {$parameterOptions ne ""} { - #puts stderr "*** ::nsf::is $parameterOptions $value // opts=$opts" + #puts stderr "*** ::nsf::is $parameterOptions $value // opts=$options" # we rely here that the nsf::is error message expresses the implementation limits - if {[string match *nonconfig* $parameterOptions]} { - set options {} - foreach o [split $parameterOptions ,] {if {$o ne "noconfig"} {lappend options $o}} - set parameterOptions [join $options ,] + set noptions {} + foreach o [split $parameterOptions ,] { + if {$o ne "noconfig"} {lappend noptions $o} } + set parameterOptions [join $noptions ,] ::nsf::is -complain $parameterOptions $value } else { set name $spec @@ -1748,15 +1748,13 @@ Object method property { {-class ""} - -incremental:switch -nocomplain:switch spec:parameter {initblock ""} } { set r [[self] ::nsf::classes::nx::Object::variable \ -accessor=true \ -class $class \ - -incremental=$incremental \ -initblock $initblock \ -nocomplain=$nocomplain \ {*}$spec] @@ -1767,18 +1765,10 @@ {-accessor:switch} {-class ""} {-config:switch} - -incremental:switch {-initblock ""} spec:parameter default:optional } { - if {$incremental} { - # the usage of "-incremental" implies "-accessor" - set accessor true - append initblock { - set :incremental 1 - } - } set slot [::nx::MetaSlot createFromParameterSpec [::nsf::self] \ -class $class \ -initblock $initblock \ @@ -1790,15 +1780,13 @@ nx::Class method property { {-class ""} - -incremental:switch spec:parameter {initblock ""} } { set r [[self] ::nsf::classes::nx::Class::variable \ -accessor=true \ -class $class \ -config=true \ - -incremental=$incremental \ -initblock $initblock \ {*}$spec] return $r