Index: TODO =================================================================== diff -u -r0ae1c72ceda94c7f6c99b86a1d7f14eaaef12e78 -r6fd5b9d632efe378ecf7df0ecfb0a2ef6b39b7c1 --- TODO (.../TODO) (revision 0ae1c72ceda94c7f6c99b86a1d7f14eaaef12e78) +++ TODO (.../TODO) (revision 6fd5b9d632efe378ecf7df0ecfb0a2ef6b39b7c1) @@ -4446,6 +4446,12 @@ - "info method syntax" returns now "/cls/ ...." - "info object method syntax" returns now "/obj/ ...." +- hopefully the last changes for ?object? method|variable|property: + defined + * "/obj/ delete object method" + * "/obj/ delete object property" + * "/obj/ delete object variable" + ======================================================================== TODO: - The two names are not appropriate Index: library/nx/nx.tcl =================================================================== diff -u -r0ae1c72ceda94c7f6c99b86a1d7f14eaaef12e78 -r6fd5b9d632efe378ecf7df0ecfb0a2ef6b39b7c1 --- library/nx/nx.tcl (.../nx.tcl) (revision 0ae1c72ceda94c7f6c99b86a1d7f14eaaef12e78) +++ library/nx/nx.tcl (.../nx.tcl) (revision 6fd5b9d632efe378ecf7df0ecfb0a2ef6b39b7c1) @@ -547,50 +547,52 @@ # # Method for deletion of properties, variables and plain methods # - Object public method "delete property" {name} { - # call explicitly the per-object variant of "info::slotobjects" - set slot [: ::nsf::methods::object::info::slotobjects -type ::nx::Slot $name] - if {$slot eq ""} {error "[self]: cannot delete object specific property '$name'"} - $slot destroy - nsf::var::unset -nocomplain [self] $name - } - Object public method "delete variable" {name} { - # First remove the instance variable and complain, if it does - # not exist. - if {[nsf::var::exists [self] $name]} { - nsf::var::unset [self] $name - } else { - error "[self]: object does not have an instance variable '$name'" + Object eval { + + :public method "delete object method" {name} { + ::nsf::method::delete [self] -per-object $name } - # call explicitly the per-object variant of "info::slotobejcts" - set slot [: ::nsf::methods::object::info::slotobjects -type ::nx::Slot $name] - if {$slot ne ""} { - # it is not a slot-less variable + :public method "delete object property" {name} { + # call explicitly the per-object variant of "info::slotobjects" + set slot [: ::nsf::methods::object::info::slotobjects -type ::nx::Slot $name] + if {$slot eq ""} {error "[self]: cannot delete object specific property '$name'"} $slot destroy + nsf::var::unset -nocomplain [self] $name } - } - Object public method "delete method" {name} { - ::nsf::method::delete [self] -per-object $name - } - Class public method "delete property" {name} { - set slot [:info slots $name] - if {$slot eq ""} {error "[self]: cannot delete property '$name'"} - $slot destroy + :public method "delete object variable" {name} { + # First remove the instance variable and complain, if it does + # not exist. + if {[nsf::var::exists [self] $name]} { + nsf::var::unset [self] $name + } else { + error "[self]: object does not have an instance variable '$name'" + } + # call explicitly the per-object variant of "info::slotobejcts" + set slot [: ::nsf::methods::object::info::slotobjects -type ::nx::Slot $name] + + if {$slot ne ""} { + # it is not a slot-less variable + $slot destroy + } + } } - Class public alias "delete variable" ::nx::Class::slot::__delete::property - Class public method "delete method" {name} { - ::nsf::method::delete [self] $name - } - # - # provide aliases for "class delete" - # - ::nx::Class eval { - :alias "delete object property" ::nx::Object::slot::__delete::property - :alias "delete object variable" ::nx::Object::slot::__delete::variable - :alias "delete object method" ::nx::Object::slot::__delete::method + Class eval { + :public method "delete method" {name} { + ::nsf::method::delete [self] $name + } + :public method "delete property" {name} { + set slot [:info slots $name] + if {$slot eq ""} {error "[self]: cannot delete property '$name'"} + $slot destroy + } + :public method "delete variable" {name} { + set slot [:info slots $name] + if {$slot eq ""} {error "[self]: cannot delete variable '$name'"} + $slot destroy + } } ###################################################################### Index: tests/info-variable.test =================================================================== diff -u -rb7c4ed543a96820dfcabddb05317236067714b4f -r6fd5b9d632efe378ecf7df0ecfb0a2ef6b39b7c1 --- tests/info-variable.test (.../info-variable.test) (revision b7c4ed543a96820dfcabddb05317236067714b4f) +++ tests/info-variable.test (.../info-variable.test) (revision 6fd5b9d632efe378ecf7df0ecfb0a2ef6b39b7c1) @@ -47,7 +47,7 @@ ? {Person info method parameters foo} {-force:switch age:integer {name ""}} ? {Person info method parameters foo force} "-force:switch" ? {Person info method parameters foo {*a[gm]*}} {age:integer {name ""}} - ? {Person info method syntax foo} "/::Person/ foo ?-force? /age/ ?/name/?" + ? {Person info method syntax foo} "/cls/ foo ?-force? /age/ ?/name/?" ? {Person info parameter syntax age:integer} "/age/" ? {Person info parameter syntax -force:switch} "?-force?" ? {Person info parameter name "a b"} "a" Index: tests/methods.test =================================================================== diff -u -r2872e1f0a6523c7fb44952492e05414c4f8d9c84 -r6fd5b9d632efe378ecf7df0ecfb0a2ef6b39b7c1 --- tests/methods.test (.../methods.test) (revision 2872e1f0a6523c7fb44952492e05414c4f8d9c84) +++ tests/methods.test (.../methods.test) (revision 6fd5b9d632efe378ecf7df0ecfb0a2ef6b39b7c1) @@ -560,30 +560,30 @@ ? {o1 info object methods -path} "{info foo} {info bar foo} foo a1 a2" ? {o1 info children} "::o1::info ::o1::per-object-slot" - ? {o1 delete method bar} "::o1: object specific method 'bar' does not exist" + ? {o1 delete object method bar} "::o1: object specific method 'bar' does not exist" # For a1, we have a method and an property. We can delete the # method without the slot. - ? {o1 delete method a1} "" + ? {o1 delete object method a1} "" # After the deletion of the accessor, the slot exists still ? {o1::per-object-slot info children} "::o1::per-object-slot::a1 ::o1::per-object-slot::a2" - # If we perform now a "delete property a1", the slot will be removed. - ? {o1 delete property a1} "" + # If we perform now a "delete object property a1", the slot will be removed. + ? {o1 delete object property a1} "" ? {o1::per-object-slot info children} "::o1::per-object-slot::a2" # try to delete the property again: - ? {o1 delete property a1} "::o1: cannot delete object specific property 'a1'" + ? {o1 delete object property a1} "::o1: cannot delete object specific property 'a1'" ? {o1 info object methods -path} "{info foo} {info bar foo} foo a2" - ? {o1 delete property a2} "" + ? {o1 delete object property a2} "" ? {o1 info object methods -path} "{info foo} {info bar foo} foo" - ? {o1 delete method foo} "" + ? {o1 delete object method foo} "" ? {o1 info object methods -path} "{info foo} {info bar foo}" - ? {o1 delete method "info foo"} "" + ? {o1 delete object method "info foo"} "" ? {o1 info object methods -path} "{info bar foo}" - ? {o1 delete method "info bar foo"} "" + ? {o1 delete object method "info bar foo"} "" ? {o1 info object methods -path} "" } Index: tests/parameters.test =================================================================== diff -u -r70dc2dc002db419eca126e8af372e0920ceb5a8a -r6fd5b9d632efe378ecf7df0ecfb0a2ef6b39b7c1 --- tests/parameters.test (.../parameters.test) (revision 70dc2dc002db419eca126e8af372e0920ceb5a8a) +++ tests/parameters.test (.../parameters.test) (revision 6fd5b9d632efe378ecf7df0ecfb0a2ef6b39b7c1) @@ -1587,18 +1587,18 @@ :method metaclassarg {-x:metaclass} {return $x} } - ? {Foo info method syntax noarg} "/::Foo/ noarg" - ? {Foo info method syntax onearg} "/::Foo/ onearg ?-x /value/?" - ? {Foo info method syntax intarg} "/::Foo/ intarg ?-x /integer/?" - ? {Foo info method syntax intsarg} "/::Foo/ intsarg ?-x /integer .../?" - ? {Foo info method syntax boolarg} "/::Foo/ boolarg ?-x /boolean/?" - ? {Foo info method syntax classarg} "/::Foo/ classarg ?-x /class/?" - ? {Foo info method syntax upperarg} "/::Foo/ upperarg ?-x /upper/?" - ? {Foo info method syntax metaclassarg} "/::Foo/ metaclassarg ?-x /metaclass/?" + ? {Foo info method syntax noarg} "/cls/ noarg" + ? {Foo info method syntax onearg} "/cls/ onearg ?-x /value/?" + ? {Foo info method syntax intarg} "/cls/ intarg ?-x /integer/?" + ? {Foo info method syntax intsarg} "/cls/ intsarg ?-x /integer .../?" + ? {Foo info method syntax boolarg} "/cls/ boolarg ?-x /boolean/?" + ? {Foo info method syntax classarg} "/cls/ classarg ?-x /class/?" + ? {Foo info method syntax upperarg} "/cls/ upperarg ?-x /upper/?" + ? {Foo info method syntax metaclassarg} "/cls/ metaclassarg ?-x /metaclass/?" # return enumeration type ? {nx::Class info method syntax "info mixinof"} \ - "/::nx::Class/ info mixinof ?-closure? ?-scope all|class|object? ?/pattern/?" + "/cls/ info mixinof ?-closure? ?-scope all|class|object? ?/pattern/?" } # @@ -1925,7 +1925,7 @@ # # property deletion should invalidate the cache as well # - c1 delete property bo2 + c1 delete object property bo2 ? {lsort [c1 info lookup configure parameters b*]} "-b1:required -bo1" } @@ -2353,8 +2353,8 @@ # nx::Object-level attributes and variables set und unset instance # variables. If we delete an object-level property or variable, # the setters for "a" will be unset. - o delete variable v - o delete property a + o delete object variable v + o delete object property a ? {o info lookup method a} "" # Both instance variables are unset