Index: library/nx/nx.tcl =================================================================== diff -u -N -rdd169437c7a701da0063a40978614e6148d71221 -r5d3bc04b5ec0a4422236a65220d94ceee17a8796 --- library/nx/nx.tcl (.../nx.tcl) (revision dd169437c7a701da0063a40978614e6148d71221) +++ library/nx/nx.tcl (.../nx.tcl) (revision 5d3bc04b5ec0a4422236a65220d94ceee17a8796) @@ -1092,8 +1092,9 @@ #puts stderr "*** returned $r" return $r } - } + + namespace eval ::nx { ###################################################################### Index: library/xotcl/library/xotcl2.tcl =================================================================== diff -u -N -rdd169437c7a701da0063a40978614e6148d71221 -r5d3bc04b5ec0a4422236a65220d94ceee17a8796 --- library/xotcl/library/xotcl2.tcl (.../xotcl2.tcl) (revision dd169437c7a701da0063a40978614e6148d71221) +++ library/xotcl/library/xotcl2.tcl (.../xotcl2.tcl) (revision 5d3bc04b5ec0a4422236a65220d94ceee17a8796) @@ -65,7 +65,7 @@ -object.init init -object.move move -object.unknown unknown - -slot.set value=assign + -slot.set value=set -slot.get value=get } @@ -429,13 +429,7 @@ set slotContainer [::nx::slotObj [::nsf::self]] foreach arg $arglist { #puts stderr "PARAMETER: [self] ::nsf::classes::nx::Class::property -accessor public $arg" - #[self] ::nsf::classes::nx::Class::property -accessor public $arg - if {[llength $arg] > 1} { - ::nx::MetaSlot createFromParameterSpec [::nsf::self] [lindex $arg 0] [lindex $arg 1] - } else { - ::nx::MetaSlot createFromParameterSpec [::nsf::self] $arg - } - #[self] ::nsf::classes::nx::Class::property -accessor public $arg + [self] ::nsf::classes::nx::Class::property -class ::xotcl::Attribute -accessor public $arg ::nsf::method:::setter [self] [lindex $arg 0] } ::nsf::var::set $slotContainer __parameter $arglist @@ -490,22 +484,22 @@ set cSlotContainer [::nx::slotObj ::xotcl::Class] set oSlotContainer [::nx::slotObj ::xotcl::Object] ::nx::RelationSlot create ${cSlotContainer}::superclass \ - -defaultmethods {get assign} - #::nsf::method::alias ${cSlotContainer}::superclass value=assign ::nsf::relation + -defaultmethods {get set} + #::nsf::method::alias ${cSlotContainer}::superclass value=set ::nsf::relation ::nx::RelationSlot create ${oSlotContainer}::class -elementtype class -multiplicity 1..1 \ - -defaultmethods {get assign} - #::nsf::method::alias ${oSlotContainer}::class value=assign ::nsf::relation + -defaultmethods {get set} + #::nsf::method::alias ${oSlotContainer}::class value=set ::nsf::relation ::nx::RelationSlot create ${oSlotContainer}::mixin -forwardername object-mixin \ - -defaultmethods {get assign} \ + -defaultmethods {get set} \ -elementtype mixinreg -multiplicity 0..n ::nx::RelationSlot create ${oSlotContainer}::filter -forwardername object-filter \ - -defaultmethods {get assign} \ + -defaultmethods {get set} \ -elementtype filterreg -multiplicity 0..n ::nx::RelationSlot create ${cSlotContainer}::instmixin -forwardername class-mixin \ - -defaultmethods {get assign} \ + -defaultmethods {get set} \ -elementtype mixinreg -multiplicity 0..n ::nx::RelationSlot create ${cSlotContainer}::instfilter -forwardername class-filter \ - -defaultmethods {get assign} \ + -defaultmethods {get set} \ -elementtype filterreg -multiplicity 0..n ######################## @@ -1049,14 +1043,14 @@ # ::xotcl::MetaSlot create ::xotcl::Attribute -superclass ::nx::VariableSlot { - :public alias value=assign ::nsf::var::set + :public alias value=set ::nsf::var::set - #:property defaultmethods {get assign} + #:property defaultmethods {get set} :property -accessor public multivalued { # - # The slot object is an nx object, therefore we need "set" - # rather than "assign" + # The slot object is an nx object, therefore we need the nx + # "set" variant no matter what xotcl2 uses. # :public object method value=set {object property value} { set mClass [expr {$value ? "0..n" : "1..1"}] @@ -1068,8 +1062,8 @@ } :protected method setterRedefinedOptions {} { - if {[:info lookup method value=assign] ne "::nsf::classes::xotcl::Attribute::value=assign"} { - # In case the "assign" method was provided on the slot, ask nsf to call it directly + if {[:info lookup method value=set] ne "::nsf::classes::xotcl::Attribute::value=set"} { + # In case the "set" method was provided on the slot, ask nsf to call it directly return [list slot=[::nsf::self] slotassign] } if {[:info lookup method value=get] ne "::nsf::classes::nx::VariableSlot::value=get"} { @@ -1084,9 +1078,9 @@ # jet. We need the methods as well for e.g. private properties, # where the setting of the property is handled via slot. # - if {[:info lookup method value=assign] eq "::nsf::classes::xotcl::Attribute::value=assign"} { + if {[:info lookup method value=set] eq "::nsf::classes::xotcl::Attribute::value=set"} { set args [list obj var [:namedParameterSpec {} value $options]] - :public object method value=assign $args {::nsf::var::set $obj $var $value} + :public object method value=set $args {::nsf::var::set $obj $var $value} } if {[:isMultivalued] && [:info lookup method value=add] eq "::nsf::classes::nx::VariableSlot::value=add"} { lappend options_single slot=[::nsf::self] @@ -1100,10 +1094,10 @@ :protected method needsForwarder {} { # # We just forward, when - # * "assign", "get" and "add" are still untouched, or + # * "set", "get" and "add" are still untouched, or # * or incremental is specified # - if {[:info lookup method value=assign] ne "::nsf::classes::xotcl::Attribute::value=assign"} {return 1} + if {[:info lookup method value=set] ne "::nsf::classes::xotcl::Attribute::value=set"} {return 1} if {[:info lookup method value=add] ne "::nsf::classes::nx::VariableSlot::value=add"} {return 1} if {[:info lookup method value=get] ne "::nsf::classes::nx::VariableSlot::value=get"} {return 1} if {[info exists :settername]} {return 1} @@ -1119,7 +1113,7 @@ $name \ -prefix value= \ ${:manager} \ - "%1 {get assign}" %self \ + "%1 {get set}" %self \ ${:forwardername} } @@ -1130,13 +1124,26 @@ return $parameterDefinitions } + :method init args { + # + # Via xotcl calling convention, init gets the residual arguments + # passed. Since nx does not allow this, we simply ignore the passed + # arguments $args. + # + nsf::next "" + } + # provide minimal compatibility :public alias proc ::nsf::classes::xotcl::Object::proc :public method exists {var} {::nsf::var::exists [self] $var} :public method istype {class} [::nx::Object info method body ::nsf::classes::xotcl::Object::istype] :public alias set -frame object ::set :public alias residualargs ::nsf::methods::object::residualargs :public alias instvar ::nsf::methods::object::instvar + + ::nsf::method::setter [self] name + ::nsf::method::setter [self] domain + ::nsf::method::setter [self] default } # @@ -1444,3 +1451,4 @@ } puts stderr "======= XOTcl $::xotcl::version$::xotcl::patchlevel loaded" } + Index: library/xotcl/tests/slottest.xotcl =================================================================== diff -u -N -rdd169437c7a701da0063a40978614e6148d71221 -r5d3bc04b5ec0a4422236a65220d94ceee17a8796 --- library/xotcl/tests/slottest.xotcl (.../slottest.xotcl) (revision dd169437c7a701da0063a40978614e6148d71221) +++ library/xotcl/tests/slottest.xotcl (.../slottest.xotcl) (revision 5d3bc04b5ec0a4422236a65220d94ceee17a8796) @@ -377,7 +377,7 @@ ? {a0 procsearch f3} "::a0 proc f3" ? {a0 procsearch f4} "::a0 forward f4" ? {a0 procsearch set} "::xotcl::Object instcmd set" -? {A::slot::foo info lookup method value=assign} "::nsf::classes::xotcl::Attribute::value=assign" +? {A::slot::foo info lookup method value=set} "::nsf::classes::xotcl::Attribute::value=set" # redefine setter for foo of class A #A slot foo method assign {domain var val} ... @@ -546,7 +546,7 @@ nx::test case assign-via-slots Class create A -slots { - Attribute create foo -default 1 -proc value=assign {domain var value} { + Attribute create foo -default 1 -proc value=set {domain var value} { if {$value < 0 || $value > 99} { error "$value is not in the range of 0 .. 99" } @@ -646,7 +646,7 @@ # Class create AA -slots { - Attribute foo -default 1 -proc value=assign {domain var value} { + Attribute foo -default 1 -proc value=set {domain var value} { if {$value < 0 || $value > 99} { error "$value is not in the range of 0 .. 99" } Index: tests/disposition.test =================================================================== diff -u -N -ra615b76dd389290567bc8506fec6fa0a3b2c14d2 -r5d3bc04b5ec0a4422236a65220d94ceee17a8796 --- tests/disposition.test (.../disposition.test) (revision a615b76dd389290567bc8506fec6fa0a3b2c14d2) +++ tests/disposition.test (.../disposition.test) (revision 5d3bc04b5ec0a4422236a65220d94ceee17a8796) @@ -1329,6 +1329,7 @@ # nx::test case xotcl-residualargs { + package prefer latest puts stderr "XOTcl loaded: [package req XOTcl 2.0]" Index: tests/parameters.test =================================================================== diff -u -N -rdd169437c7a701da0063a40978614e6148d71221 -r5d3bc04b5ec0a4422236a65220d94ceee17a8796 --- tests/parameters.test (.../parameters.test) (revision dd169437c7a701da0063a40978614e6148d71221) +++ tests/parameters.test (.../parameters.test) (revision 5d3bc04b5ec0a4422236a65220d94ceee17a8796) @@ -1846,6 +1846,7 @@ package prefer latest package req XOTcl 2.0 + xotcl::Class create CC -parameter {package_id parameter_declaration user_id} # first, without list notation