Index: TODO =================================================================== diff -u -r4536c2540977c43aaf422800dab048e5d9063b3f -r1cff689f123bad35c4e3358527e2efa18f53c838 --- TODO (.../TODO) (revision 4536c2540977c43aaf422800dab048e5d9063b3f) +++ TODO (.../TODO) (revision 1cff689f123bad35c4e3358527e2efa18f53c838) @@ -2480,6 +2480,18 @@ * added regression tests + * removed methods ::nx::Class.recreate and + ::nx::Class.recreate from predefined method-set + ::nx::Object.configure from predefined method-set + + + * added defintions such that these methods can be loaded via + ::nsf::method::require ::nx::Class recreate + ::nsf::method::require ::nx::Object configure + +nsf: + * added CallDirectly() wrapper for calls to "init" + TODO: - when alloc|dealloc are loaded via require, we have Index: generic/nsf.c =================================================================== diff -u -r4536c2540977c43aaf422800dab048e5d9063b3f -r1cff689f123bad35c4e3358527e2efa18f53c838 --- generic/nsf.c (.../nsf.c) (revision 4536c2540977c43aaf422800dab048e5d9063b3f) +++ generic/nsf.c (.../nsf.c) (revision 1cff689f123bad35c4e3358527e2efa18f53c838) @@ -11652,23 +11652,23 @@ INCR_REF_COUNT(resultObj); Tcl_ListObjGetElements(interp, resultObj, &nobjc, &nobjv); - /* - * Trying CallDirectly does not make much sense, since init is - * already defined in predefined - */ - methodObj = NsfMethodObj(object, NSF_o_init_idx); - /* * Flag the call to "init" before the dispatch, such that a call to * "configure" within init does not clear the already set instance * variables. */ + object->flags |= NSF_INIT_CALLED; - if (methodObj) { + if (CallDirectly(interp, object, NSF_o_init_idx, &methodObj)) { + fprintf(stderr, "%s init directly\n", ObjectName(object)); + result = TCL_OK; + } else { + fprintf(stderr, "%s init dispatch\n", ObjectName(object)); result = CallMethod((ClientData) object, interp, methodObj, nobjc+2, nobjv, NSF_CM_NO_PROTECT|NSF_CSC_IMMEDIATE); } + DECR_REF_COUNT(resultObj); } Index: library/nx/nx.tcl =================================================================== diff -u -r4536c2540977c43aaf422800dab048e5d9063b3f -r1cff689f123bad35c4e3358527e2efa18f53c838 --- library/nx/nx.tcl (.../nx.tcl) (revision 4536c2540977c43aaf422800dab048e5d9063b3f) +++ library/nx/nx.tcl (.../nx.tcl) (revision 1cff689f123bad35c4e3358527e2efa18f53c838) @@ -38,7 +38,7 @@ # foreach cmd [info command ::nsf::methods::object::*] { set cmdName [namespace tail $cmd] - if {$cmdName in [list "autoname" "cleanup" "exists" \ + if {$cmdName in [list "autoname" "cleanup" "configure" "exists" \ "filterguard" "instvar" "mixinguard" \ "noinit" "requirenamespace"]} continue ::nsf::method::alias Object $cmdName $cmd @@ -54,7 +54,7 @@ # provide the standard command set for Class foreach cmd [info command ::nsf::methods::class::*] { set cmdName [namespace tail $cmd] - if {$cmdName in [list "filterguard" "mixinguard" "alloc" "dealloc"]} continue + if {$cmdName in [list "filterguard" "mixinguard" "alloc" "dealloc" "recreate"]} continue # set tgt [Class ::nsf::methods::class::info::methods -methodtype alias -callprotection all $cmdName] #if {$tgt ne "" && [::nsf::method::property Class $cmdName redefine-protected]} { # ::nsf::method::property Class $cmdName redefine-protected false @@ -69,9 +69,6 @@ ::nsf::method::property Object $cmd call-protected 1 } - foreach cmd [list recreate] { - ::nsf::method::property Class $cmd call-protected 1 - } unset cmd # protect some methods against redefinition @@ -80,8 +77,10 @@ #::nsf::method::property Class dealloc redefine-protected true ::nsf::method::property Class create redefine-protected true - ::nsf::method::provide alloc {::nsf::method::alias alloc ::nsf::methods::class::alloc} - ::nsf::method::provide dealloc {::nsf::method::alias dealloc ::nsf::methods::class::dealloc} + ::nsf::method::provide alloc {::nsf::method::alias alloc ::nsf::methods::class::alloc} + ::nsf::method::provide dealloc {::nsf::method::alias dealloc ::nsf::methods::class::dealloc} + ::nsf::method::provide recreate {::nsf::method::alias recreate ::nsf::methods::class::recreate} + ::nsf::method::provide configure {::nsf::method::alias configure ::nsf::methods::object::configure} # # The method __resolve_method_path resolves a space separated path Index: tests/info-method.test =================================================================== diff -u -r4536c2540977c43aaf422800dab048e5d9063b3f -r1cff689f123bad35c4e3358527e2efa18f53c838 --- tests/info-method.test (.../info-method.test) (revision 4536c2540977c43aaf422800dab048e5d9063b3f) +++ tests/info-method.test (.../info-method.test) (revision 1cff689f123bad35c4e3358527e2efa18f53c838) @@ -68,8 +68,8 @@ ? {::nx::Object info lookup methods -source application} "" ? {::nx::Class info lookup methods -source application} "" - set object_methods "alias attribute class configure contains copy destroy eval filter forward info method mixin move protected public require volatile" - set class_methods "alias attribute attributes class class-object configure contains copy create destroy eval filter forward info method mixin move new protected public require superclass volatile" + set object_methods "alias attribute class contains copy destroy eval filter forward info method mixin move protected public require volatile" + set class_methods "alias attribute attributes class class-object contains copy create destroy eval filter forward info method mixin move new protected public require superclass volatile" ? {lsort [::nx::Object info lookup methods -source baseclasses]} $class_methods ? {lsort [::nx::Class info lookup methods -source baseclasses]} $class_methods Index: tests/parameters.test =================================================================== diff -u -r65f8883a4596ea98365b7de1652700e3ac7394cc -r1cff689f123bad35c4e3358527e2efa18f53c838 --- tests/parameters.test (.../parameters.test) (revision 65f8883a4596ea98365b7de1652700e3ac7394cc) +++ tests/parameters.test (.../parameters.test) (revision 1cff689f123bad35c4e3358527e2efa18f53c838) @@ -812,6 +812,7 @@ # Test case parameter-alias-default { + ::nsf::method::require nx::Object configure Class create C { :attribute {a ""} :attribute {b 1}