Index: TODO =================================================================== diff -u -rd9a6fbf56b9559455a3b57a31dcc76b388b2b1ab -rb9e39fb7a7a01c2b07a112700d42060eadde4d8d --- TODO (.../TODO) (revision d9a6fbf56b9559455a3b57a31dcc76b388b2b1ab) +++ TODO (.../TODO) (revision b9e39fb7a7a01c2b07a112700d42060eadde4d8d) @@ -2676,6 +2676,22 @@ TODO: +- Harmonising no-self-object error messages: Currently, we have at + least two (or even three) different variants of an intentionally + single message: + * No current object + * Cannot resolve 'self', probably called outside the context of a Next Scripting Object + * (in NsfDispatchClientDataError(), a confusingly similar wording is + used: "not dispatched on valid object"). +- Refactoring the inline occurrences of NsfPrintError() into a custom + function, e.g., NsfSelfObjectError()? +- Looking, for instance, at NsfProcAliasMethod(). I might be missing + the obvious, but does it make sense to differentiate between + GetSelfObj(interp) == NULL and tcd->object == NULL?! What is the + difference between NsfDispatchClientDataError() and a prospective + NsfSelfObjectError(), anyways?! ClientData representing the + definition (provider) object, and self the receiver object? + - the last two results of "info heritage" in info-method.test are not what we want (e.g. ::M3 ::B ::M3 ::nx::Object); would not be surprised if the same problem occursn somewhere else Index: generic/nsf.c =================================================================== diff -u -rd9a6fbf56b9559455a3b57a31dcc76b388b2b1ab -rb9e39fb7a7a01c2b07a112700d42060eadde4d8d --- generic/nsf.c (.../nsf.c) (revision d9a6fbf56b9559455a3b57a31dcc76b388b2b1ab) +++ generic/nsf.c (.../nsf.c) (revision b9e39fb7a7a01c2b07a112700d42060eadde4d8d) @@ -12702,13 +12702,17 @@ Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) { AliasCmdClientData *tcd = (AliasCmdClientData *)clientData; - NsfObject *self = tcd->object; + NsfObject *self = GetSelfObj(interp); CONST char *methodName = ObjStr(objv[0]); + if (!self) { + return NsfPrintError(interp, "Cannot resolve 'self', " + "probably called outside the context of a Next Scripting Object"); + } - assert(tcd->object == GetSelfObj(interp)); + assert(tcd->object == self); if (self == NULL) { - return NsfDispatchClientDataError(interp, self, "object", + return NsfDispatchClientDataError(interp, tcd->object, "object", Tcl_GetCommandName(interp, tcd->aliasCmd)); } @@ -15423,7 +15427,7 @@ NsfObject *self = GetSelfObj(interp); if (!self) { return NsfPrintError(interp, "Cannot resolve 'self', " - "probably called outside the context of an Next Scripting Object"); + "probably called outside the context of a Next Scripting Object"); } /* fprintf(stderr, "Colon dispatch %s.%s\n", ObjectName(self),ObjStr(nobjv[0]));*/ return ObjectDispatch(self, interp, nobjc, nobjv, NSF_CM_NO_SHIFT); @@ -15880,7 +15884,7 @@ if (!self) { return NsfPrintError(interp, "Cannot resolve 'self', " - "probably called outside the context of an Next Scripting Object"); + "probably called outside the context of a Next Scripting Object"); } if (withLocal) {