Index: generic/nsf.c =================================================================== diff -u -red6780990bc29b7ad2baca989887193bd8d85f79 -r265965e7feb81522a3fdf5d29e4883846abe77cb --- generic/nsf.c (.../nsf.c) (revision ed6780990bc29b7ad2baca989887193bd8d85f79) +++ generic/nsf.c (.../nsf.c) (revision 265965e7feb81522a3fdf5d29e4883846abe77cb) @@ -21445,13 +21445,13 @@ /* classMethod new NsfCNewMethod { - {-argName "-childof" -type object -nrargs 1} + {-argName "-childof" -required 0 -type tclobj} {-argName "args" -required 0 -type args} } */ static int -NsfCNewMethod(Tcl_Interp *interp, NsfClass *cl, NsfObject *withChildof, +NsfCNewMethod(Tcl_Interp *interp, NsfClass *cl, Tcl_Obj *withChildof, int objc, Tcl_Obj *CONST objv[]) { Tcl_Obj *fullnameObj; int result, prefixLength; @@ -21462,7 +21462,29 @@ Tcl_DStringInit(dsPtr); if (withChildof) { - Tcl_DStringAppend(dsPtr, ObjectName(withChildof), -1); + CONST char *parentName = ObjStr(withChildof); + /* + * If parentName is fully qualified, use it as prefix, else prepend the + * CallingNameSpace() to be compatible with the object name completion. + */ + if (*parentName == ':' && *(parentName + 1) == ':') { + /* + * Prepend parentName only if it is not "::" + */ + if (*(parentName + 2) != '\0') { + Tcl_DStringAppend(dsPtr, parentName, -1); + } + } else { + Tcl_Obj *tmpName = NameInNamespaceObj(interp, parentName, CallingNameSpace(interp)); + CONST char *completedParentName; + + INCR_REF_COUNT(tmpName); + completedParentName = ObjStr(tmpName); + if (strcmp(completedParentName, "::")) { + Tcl_DStringAppend(dsPtr, ObjStr(tmpName), -1); + } + DECR_REF_COUNT(tmpName); + } Tcl_DStringAppend(dsPtr, "::__#", 5); } else { Tcl_DStringAppend(dsPtr, "::nsf::__#", 10); Index: generic/nsfAPI.decls =================================================================== diff -u -ra390a38437dec2a7c3461f9fadef108ebf74b928 -r265965e7feb81522a3fdf5d29e4883846abe77cb --- generic/nsfAPI.decls (.../nsfAPI.decls) (revision a390a38437dec2a7c3461f9fadef108ebf74b928) +++ generic/nsfAPI.decls (.../nsfAPI.decls) (revision 265965e7feb81522a3fdf5d29e4883846abe77cb) @@ -296,7 +296,7 @@ } classMethod new NsfCNewMethod { - {-argName "-childof" -type object} + {-argName "-childof" -required 0 -type tclobj} {-argName "args" -required 0 -type args} } Index: generic/nsfAPI.h =================================================================== diff -u -ra390a38437dec2a7c3461f9fadef108ebf74b928 -r265965e7feb81522a3fdf5d29e4883846abe77cb --- generic/nsfAPI.h (.../nsfAPI.h) (revision a390a38437dec2a7c3461f9fadef108ebf74b928) +++ generic/nsfAPI.h (.../nsfAPI.h) (revision 265965e7feb81522a3fdf5d29e4883846abe77cb) @@ -313,7 +313,7 @@ static int NsfCDeallocMethod(Tcl_Interp *interp, NsfClass *cl, Tcl_Obj *object); static int NsfCFilterGuardMethod(Tcl_Interp *interp, NsfClass *cl, CONST char *filter, Tcl_Obj *guard); static int NsfCMixinGuardMethod(Tcl_Interp *interp, NsfClass *cl, Tcl_Obj *mixin, Tcl_Obj *guard); -static int NsfCNewMethod(Tcl_Interp *interp, NsfClass *cl, NsfObject *withChildof, int nobjc, Tcl_Obj *CONST nobjv[]); +static int NsfCNewMethod(Tcl_Interp *interp, NsfClass *cl, Tcl_Obj *withChildof, int nobjc, Tcl_Obj *CONST nobjv[]); static int NsfCRecreateMethod(Tcl_Interp *interp, NsfClass *cl, Tcl_Obj *objectName, int objc, Tcl_Obj *CONST objv[]); static int NsfCSuperclassMethod(Tcl_Interp *interp, NsfClass *cl, Tcl_Obj *superclasses); static int NsfClassInfoFilterguardMethod(Tcl_Interp *interp, NsfClass *cl, CONST char *filter); @@ -609,7 +609,7 @@ &pc) != TCL_OK) { return TCL_ERROR; } else { - NsfObject *withChildof = (NsfObject *)pc.clientData[0]; + Tcl_Obj *withChildof = (Tcl_Obj *)pc.clientData[0]; assert(pc.status == 0); return NsfCNewMethod(interp, cl, withChildof, objc-pc.lastObjc, objv+pc.lastObjc); @@ -2416,7 +2416,7 @@ {"guard", NSF_ARG_REQUIRED, 1, Nsf_ConvertToTclobj, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}} }, {"::nsf::methods::class::new", NsfCNewMethodStub, 2, { - {"-childof", 0, 1, Nsf_ConvertToObject, NULL,NULL,"object",NULL,NULL,NULL,NULL,NULL}, + {"-childof", 0, 1, Nsf_ConvertToTclobj, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}, {"args", 0, 1, ConvertToNothing, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}} }, {"::nsf::methods::class::recreate", NsfCRecreateMethodStub, 2, {