Index: TODO =================================================================== diff -u -N -rcd631185c59d3d8b69ab8611fb822302692672f4 -r6eee126915e363e7bdc5d2e43a1157b791247e30 --- TODO (.../TODO) (revision cd631185c59d3d8b69ab8611fb822302692672f4) +++ TODO (.../TODO) (revision 6eee126915e363e7bdc5d2e43a1157b791247e30) @@ -4681,18 +4681,29 @@ - fix a small memory leak for PER_OBJECT_PARAMETER_CACHING - all cases detectable with --enable-memcount=yes are fixed - -======================================================================== -TODO: - - recheck Announce - concatenate Changelog - update next-scriping doc + examples, pdf-files? - build tar etc. as in README.release +nsf.c: +- dont't use the default of a invocation parameter in "configure" + when the object is already initialized. The default is in + general only used when the parameter is not specified. We do not want + e.g. superclass to be reset to ::nx::Object, when configure is + called on a class without arguments. +- extended regression test + + +======================================================================== +TODO: + + + Stefan: doc items - make rough comparison table with NX, XOTcl, tclOO, itcl, Ruby, Python + comparison NX vs. TclOO is most probably the most important Most general superclass Metaclass Per-object methods Index: generic/nsf.c =================================================================== diff -u -N -r85ad68780a2a577e6db6ea00b93656ec1a7e3ffd -r6eee126915e363e7bdc5d2e43a1157b791247e30 --- generic/nsf.c (.../nsf.c) (revision 85ad68780a2a577e6db6ea00b93656ec1a7e3ffd) +++ generic/nsf.c (.../nsf.c) (revision 6eee126915e363e7bdc5d2e43a1157b791247e30) @@ -22216,6 +22216,16 @@ paramPtr->name, paramPtr->flags, pc.full_objv[i]);*/ continue; } + } else if (object->flags & NSF_INIT_CALLED) { + /* + * The object is already initialized. Don't use the default, since it + * might change part of the state back to the original default. This + * might happen, when e.g. configure is called on a class manually, + * where "superclass" has a default. + */ + /*fprintf(stderr, "%s skip default %s in configure\n", + ObjectName(object), ObjStr(pc.full_objv[i]));*/ + continue; } } else if (unlikely(paramPtr->flags & NSF_ARG_REQUIRED && pc.full_objv[i] == NsfGlobalObjs[NSF___UNKNOWN__])) { @@ -22336,7 +22346,6 @@ } continue; } - result = ParameterMethodDispatch(interp, object, paramPtr, newValue, uplevelVarFramePtr, initString, objv[pc.lastObjc], (Tcl_Obj **)&objv[pc.lastObjc + 1], Index: tests/disposition.test =================================================================== diff -u -N -r45e24b34c85bf0fc3e14db5250550100bd07ff31 -r6eee126915e363e7bdc5d2e43a1157b791247e30 --- tests/disposition.test (.../disposition.test) (revision 45e24b34c85bf0fc3e14db5250550100bd07ff31) +++ tests/disposition.test (.../disposition.test) (revision 6eee126915e363e7bdc5d2e43a1157b791247e30) @@ -1414,3 +1414,28 @@ # TODO: what todo with object parameter inspection for names with # alias, forward... "names" do not always correspond with vars set. +nx::test case class-configure-default { + + # Background: when class is created, it is created with a "default" + # superclass of "::nx::Object". This is defined in the slot for + # superclass in nx.tcl + + nx::Class create P + ? {Q info superclass} ::nx::Object + + # + # When we pass the superclass a different value, this is certainly used. + # + nx::Class create Q -superclass P + ? {Q info superclass} ::P + + # + # When we call configure on the superclass, we do not want the + # default to be used to reset it to ::nx::Object. Therefore the + # configure uses the default for parameters with METHOD_INVOCATION + # only, when the object is not yet initialized. + # + Q configure + ? {Q info superclass} ::P + +} \ No newline at end of file