Index: TODO =================================================================== diff -u -r544f573ac36f1d0f9213b5ab920bc333de14e4e5 -r9246ffdfb2716a6abbf3709990abb9c4453eb461 --- TODO (.../TODO) (revision 544f573ac36f1d0f9213b5ab920bc333de14e4e5) +++ TODO (.../TODO) (revision 9246ffdfb2716a6abbf3709990abb9c4453eb461) @@ -2421,8 +2421,37 @@ * make "configure --help" more pretty * simplify configure.in +- added first version of "nsf::methoddelete" +- extended regression test +- updated TODO + TODO: +- explizites [::nsf::method delete] (sinngemäss), als ergänzung zum "{} {}"-idiom + we could extend "::nsf::method obj methodname ...." towards a + "::nsf::method create|destroy obj methodname ....", but this would + be an asymmetry for nsf::alice, nsf::forward, etc. + + An option would be an ::nsf::methodelete in accoradance with methodproperty + + nsfCmd methodproperty NsfMethodPropertyCmd { + {-argName "object" -required 1 -type object} + {-argName "-per-object"} + {-argName "methodName" -required 1 -type tclobj} + +- implemented above suggestion; two more issues: + * fix crash for non-existing per-object procs + * add "... method exists ...." + * document "nsf::methoddelete" (or find a better name for it) + * extend regression test + +- fix misleading error message: + nx::Class create C { + :public method foo {x} {return $x} + :public object method bar {x} {return $x} + :create c1 + } + - serializer: check, why catch is needed for object-level alias (search for ns_cache_flush) - check cases of -flag=$value outside the context of nsf::procs @@ -2432,7 +2461,7 @@ - object parameter type forward: - regression test - reduce verbosity - - get rid of eager tcd creation (optimization, can go to guture releases) + - get rid of eager tcd creation (optimization, can go to future releases) - slotmachinerie 2 - naming "incremental", "reconfigure" @@ -2494,20 +2523,10 @@ * migration guide 3.8. Dispatch, Aliases, etc.: to be done or omitted -- check performance implications of value conflict checker +- check performance implications of value checker -- explizites [::nsf::method delete] (sinngemäss), als ergänzung zum "{} {}"-idiom - extend coro regression test -- C-interface - * rework C-interface - * maybe for post-alpha, but we have be first clear - on scope and intention. A possibility would be - to provide all entries from gentclAPI, but we would - loose most likely static property and the newly - achieved ease of changing is effectively frozen - by the stubs interface, which has to be stable. - - nameing * namespace prefix @@ -2581,36 +2600,40 @@ #endif -For future releases: +For future releases (after first alpha/beta release) - * consider alternate method name/place for subcmds (and/or slots) on classes + * Consider alternate method name/place for subcmds (and/or slots) on classes - currently, there are potentail conflicts between slots and ensemble objects - provide a different place in the namesspaces could simplify this - - * argument passing of C functions is currently based on an - interpreter of the argument lists. It should be possible to turn - the interpreter into a compiler to speed up argument passing. But - maybe, this would bloat the code-size. - * canonical reps: - "p:integer,multivalued" => "-name p -type integer -multivalued" - "x:type,arg=::D d1" => "-name x -type type -arg ::D -default d1" + * Ensembles + - It could be possible to reduce stack frames in ensembles. Just a + top ensemble frame could be sufficient. + - The full names for ensemble methods could be stored in the cmd tables + to make lookup faster. - * rework implict namespace completion (NameInNamespaceObj(), - maybe based on BeginOfCallChain()). - - * use parameter syntax in genTclAPI - - * it could be possible to reduce stack frames in ensembles. Just a - top ensemble frame could be sufficient. - - * the full names for ensemble methods could be stored in the cmd tables - to make lookup faster. - - * serializer: handing of xo::at_cleanup in serializer + * Serializer: handing of xo::at_cleanup in serializer (either generailization or move to OpenACS/aolserver init/naviserver init) - * NsfClassListAdd() and friends could be made generic + * Parameter/argument handling + - Canonical parameter representations: + "p:integer,multivalued" => "-name p -type integer -multivalued" + "x:type,arg=::D d1" => "-name x -type type -arg ::D -default d1" + - Argument passing of C functions is currently based on an + interpreter of the argument lists. It should be possible to turn + the interpreter into a compiler to speed up argument passing. But + maybe, this would bloat the code-size. + - Use parameter syntax in genTclAPI + + * C-Code + * Several of the tracing options in nsf.h could be replaced by DTrace + * Rework implict namespace completion (NameInNamespaceObj(), + maybe based on BeginOfCallChain()). + * Rework C-interface (maybe for post-alpha, but we have be first + clear on scope and intention. A possibility would be to provide + all entries from gentclAPI, but we would loose most likely + static property and the newly achieved ease of changing is + effectively frozen by the stubs interface, which has to be + stable. + * NsfClassListAdd() and friends could be made generic - * Several of the tracing options in nsf.h could be replaced by DTrace - Index: generic/nsf.tcl =================================================================== diff -u -r39306d4d36096f20dba3262638e2a87f04e90111 -r9246ffdfb2716a6abbf3709990abb9c4453eb461 --- generic/nsf.tcl (.../nsf.tcl) (revision 39306d4d36096f20dba3262638e2a87f04e90111) +++ generic/nsf.tcl (.../nsf.tcl) (revision 9246ffdfb2716a6abbf3709990abb9c4453eb461) @@ -37,6 +37,26 @@ } } + # + # proc for deleting methods + # + nsf::proc ::nsf::methoddelete {object:object -per-object:switch methodName} { + if {${per-object}} { + set handle [$object ::nsf::methods::object::info::method handle $methodName] + } else { + set handle [$object ::nsf::methods::class::info::method handle $methodName] + } + if {$handle ne ""} { + ::nsf::method $object {*}[expr {${per-object} ? "-per-object" : ""}] $methodName "" "" + } else { + error "Object $object: method $methodName is not defined" + } + } + + # + # The following helper proc is used e.g. in OpenACS to pair + # introspection with nsf::procs. + # ::proc strip_proc_name {name} { if {[string match ::nsf::procs::* $name]} { return [string range $name 12 end] Index: generic/predefined.h =================================================================== diff -u -r821c01bd241c51be4fa0931d423d8f8658606ee1 -r9246ffdfb2716a6abbf3709990abb9c4453eb461 --- generic/predefined.h (.../predefined.h) (revision 821c01bd241c51be4fa0931d423d8f8658606ee1) +++ generic/predefined.h (.../predefined.h) (revision 9246ffdfb2716a6abbf3709990abb9c4453eb461) @@ -15,6 +15,13 @@ "eval [linsert $cmd 1 $object]} else {\n" "eval [linsert $(definition) 1 $object]}} else {\n" "error \"cannot require method $name for $object, method unknown\"}}\n" +"nsf::proc ::nsf::methoddelete {object:object -per-object:switch methodName} {\n" +"if {${per-object}} {\n" +"set handle [$object ::nsf::methods::object::info::method handle $methodName]} else {\n" +"set handle [$object ::nsf::methods::class::info::method handle $methodName]}\n" +"if {$handle ne \"\"} {\n" +"::nsf::method $object {*}[expr {${per-object} ? \"-per-object\" : \"\"}] $methodName \"\" \"\"} else {\n" +"error \"Object $object: method $methodName is not defined\"}}\n" "::proc strip_proc_name {name} {\n" "if {[string match ::nsf::procs::* $name]} {\n" "return [string range $name 12 end]} elseif {[string match nsf::procs::* $name]} {\n" Index: tests/method-modifiers.test =================================================================== diff -u -rbd1cce484140aaf66113cf647f060ae48d32b24f -r9246ffdfb2716a6abbf3709990abb9c4453eb461 --- tests/method-modifiers.test (.../method-modifiers.test) (revision bd1cce484140aaf66113cf647f060ae48d32b24f) +++ tests/method-modifiers.test (.../method-modifiers.test) (revision 9246ffdfb2716a6abbf3709990abb9c4453eb461) @@ -361,3 +361,23 @@ ? {c1 a b} {expected integer but got "b" for parameter "a"} } +# +# Test method deletion +# +Test parameter count 1 + +Test case methoddelete { + nx::Class create C { + :public method foo {x} {return $x} + :public class-object method bar {x} {return $x} + :create c1 + } + + ? {::nsf::methoddelete C x} "Object C: method x is not defined" + #? {::nsf::methoddelete C -per-object x} "Object C: method x is not defined" + ? {::nsf::methoddelete C foo} "" + ? {::nsf::methoddelete C foo} "Object C: method foo is not defined" + ? {::nsf::methoddelete C bar} "Object C: method bar is not defined" + ? {::nsf::methoddelete C -per-object bar} "" + #? {::nsf::methoddelete C -per-object bar} "" +} \ No newline at end of file