Index: TODO =================================================================== diff -u -ra63f9df71012c9cd78755d63c84410a1d51d7e1b -rd56697c9bad9703c7d627479b80201ab9cfee09e --- TODO (.../TODO) (revision a63f9df71012c9cd78755d63c84410a1d51d7e1b) +++ TODO (.../TODO) (revision d56697c9bad9703c7d627479b80201ab9cfee09e) @@ -1077,6 +1077,10 @@ to per-object mixins with meta-classes - make slot optimizer more robust +- removed methods object-mixin and object-filter from the interface. + (Caused some duplication of logic in the method "object") +_ added option noforwarder to RelationSlots +- some minor cleanup TODO: - nameing Index: library/nx/nx.tcl =================================================================== diff -u -ra63f9df71012c9cd78755d63c84410a1d51d7e1b -rd56697c9bad9703c7d627479b80201ab9cfee09e --- library/nx/nx.tcl (.../nx.tcl) (revision a63f9df71012c9cd78755d63c84410a1d51d7e1b) +++ library/nx/nx.tcl (.../nx.tcl) (revision d56697c9bad9703c7d627479b80201ab9cfee09e) @@ -143,7 +143,23 @@ return [::nx::objectInfo [lindex $args 0] [::nsf::current object] {*}[lrange $args 1 end]] } if {$what in [list "filter" "mixin"]} { - return [:object-$what {*}$args] + # + # It would be much easier, to do a + # + # return [:object-$what {*}$args] + # + # here. However, since we removed "object-mixin" and friends + # from the registered methods, we have to emulate the work of + # the forwarder. + # + switch [llength $args] { + 0 {return [::nsf::relation [::nsf::current object] object-$what]} + 1 {return [::nsf::relation [::nsf::current object] object-$what {*}$args]} + default {return [::nx::Class::slot::object-$what [lindex $args 0] \ + [::nsf::current object] object-$what \ + {*}[lrange $args 1 end]] + } + } } if {$what in [list "filterguard" "mixinguard"]} { return [::nsf::dispatch [::nsf::current object] ::nsf::cmd::Object::$what {*}$args] @@ -387,7 +403,6 @@ } foreach cmd [info command ::nsf::cmd::ClassInfo::*] { set cmdName [namespace tail $cmd] - if {$cmdName in [list "object-mixin-of" "class-mixin-of"]} continue ::nsf::alias ::nx::classInfo $cmdName $cmd } unset cmd @@ -707,7 +722,10 @@ if {${:per-object} && [info exists :default] } { ::nsf::setvar ${:domain} ${:name} ${:default} } - set cl [expr {${:per-object} ? "Object" : "Class"}] + if {[info exists :noforwarder]} { + #puts stderr "Do not register forwarder ${:domain} ${:name}" + return + } #puts stderr "Slot [::nsf::current object] init, forwarder on ${:domain}" ::nsf::forward ${:domain} ${:name} \ ${:manager} \ @@ -841,6 +859,7 @@ {multivalued true} {type relation} {elementtype ::nx::Class} + {noforwarder} } ::nsf::relation RelationSlot superclass ObjectParameterSlot @@ -985,8 +1004,8 @@ # Create two conveniance slots to allow configuration of # object-slots for classes via object-mixin - ::nx::RelationSlot create ${os}::Class::slot::object-mixin - ::nx::RelationSlot create ${os}::Class::slot::object-filter -elementtype "" + ::nx::RelationSlot create ${os}::Class::slot::object-mixin -noforwarder 1 + ::nx::RelationSlot create ${os}::Class::slot::object-filter -elementtype "" -noforwarder 1 } ::nsf::register_system_slots ::nx Index: tests/interceptor-slot.tcl =================================================================== diff -u -re548a952433b4d26794f535995c9ed1ababe8807 -rd56697c9bad9703c7d627479b80201ab9cfee09e --- tests/interceptor-slot.tcl (.../interceptor-slot.tcl) (revision e548a952433b4d26794f535995c9ed1ababe8807) +++ tests/interceptor-slot.tcl (.../interceptor-slot.tcl) (revision d56697c9bad9703c7d627479b80201ab9cfee09e) @@ -53,11 +53,11 @@ # adding, removing per-object mixins for classes through slot # "object-mixin" # -C object-mixin M -? {C info precedence} "::M ::nx::Class ::nx::Object" -? {C object info mixin} "::M" -C object-mixin "" -? {C info precedence} "::nx::Class ::nx::Object" +# C object-mixin M +# ? {C info precedence} "::M ::nx::Class ::nx::Object" +# ? {C object info mixin} "::M" +# C object-mixin "" +# ? {C info precedence} "::nx::Class ::nx::Object" # # add and remove object mixin for classes via modifier "object" and @@ -96,7 +96,7 @@ ? {C info precedence} "::M ::nx::Class ::nx::Object" # forwarder with 0 arguments + flag -? {C object-mixin} "::M" +? {C object mixin} "::M" puts stderr "==================== XOTcl" package require XOTcl