Index: generic/nsf.c =================================================================== diff -u -r76454eeb255e395a6a19345d558e0e96a9c47159 -r8d45ee4442be4ba3222fa1abaeacd94a7aa02cc3 --- generic/nsf.c (.../nsf.c) (revision 76454eeb255e395a6a19345d558e0e96a9c47159) +++ generic/nsf.c (.../nsf.c) (revision 8d45ee4442be4ba3222fa1abaeacd94a7aa02cc3) @@ -608,9 +608,8 @@ ParseContextRelease(ParseContext *pcPtr) { int status = pcPtr->status; - /*fprintf(stderr, "ParseContextRelease %p status %.6x %d elements, " - "called from %s\n", - pcPtr, status, pcPtr->objc, msg);*/ + /*fprintf(stderr, "ParseContextRelease %p status %.6x %d elements\n", + pcPtr, status, pcPtr->objc);*/ #if !defined(NDEBUG) { @@ -619,7 +618,7 @@ * context are at release time sometimes only partially initialized, the * following holds true for ensuring correct release of Tcl_Objs: * - * 1) if one of the objv-flags has NSF_PC_MUST_DECR set, + * 1) if one of the objv-flags has NSF_PC_MUST_DECR set, * then the status flag NSF_PC_STATUS_MUST_DECR has to * be set as well. * @@ -11414,7 +11413,7 @@ */ *outObjPtr = Tcl_GetObjResult(interp); INCR_REF_COUNT2("valueObj", *outObjPtr); - /*fprintf(stderr, "**** NSF_ARG_IS_CONVERTER\n");*/ + /*fprintf(stderr, "**** NSF_ARG_IS_CONVERTER %p\n", *outObjPtr);*/ } *clientData = (ClientData) *outObjPtr; @@ -11561,6 +11560,12 @@ } else if (strncmp(option, "forward", 7) == 0) { paramPtr->flags |= NSF_ARG_FORWARD; + } else if (strncmp(option, "invokesetter", 12) == 0) { + if (unlikely(paramPtr->slotObj == NULL)) { + return NsfPrintError(interp, "option 'invokesetter' must follow 'slot='"); + } + paramPtr->flags |= NSF_ARG_INVOKESETTER; + } else if ((dotdot = strnstr(option, "..", optionLength))) { /* check lower bound */ if (*option == '0') { @@ -21532,10 +21537,11 @@ #endif /* * Actually set instance variable with the provided value or default - * value. In case, we have a slot provided, use it for initialization. + * value. In case, explicit invocation of the setter is needed, we call the method, which + * is typically a forwarder to the slot object. */ - if (paramPtr->slotObj) { + if (paramPtr->flags & NSF_ARG_INVOKESETTER) { result = NsfCallMethodWithArgs(interp, (Nsf_Object *)object, paramPtr->nameObj, newValue, 1, NULL, NSF_CSC_IMMEDIATE); } else {