Index: generic/nsf.c =================================================================== diff -u -rbb4f5c65acffb4f0b8f399b3185cf1d670f9864b -r76454eeb255e395a6a19345d558e0e96a9c47159 --- generic/nsf.c (.../nsf.c) (revision bb4f5c65acffb4f0b8f399b3185cf1d670f9864b) +++ generic/nsf.c (.../nsf.c) (revision 76454eeb255e395a6a19345d558e0e96a9c47159) @@ -21228,8 +21228,8 @@ : NULL; /* - * Push frame to allow for [self] and make instance variables of obj accessible as - * locals. + * Push frame to allow for [self] and make instance variables of obj + * accessible as locals. */ Nsf_PushFrameObj(interp, object, framePtr); @@ -21527,14 +21527,20 @@ */ if (i < paramDefs->nrParams || !pc.varArgs) { #if defined(CONFIGURE_ARGS_TRACE) - fprintf(stderr, "*** %s SET %s '%s'\n", - ObjectName(object), ObjStr(paramPtr->nameObj), ObjStr(newValue)); + fprintf(stderr, "*** %s SET %s '%s' // %p\n", + ObjectName(object), ObjStr(paramPtr->nameObj), ObjStr(newValue), paramPtr->slotObj); #endif /* * Actually set instance variable with the provided value or default - * value. + * value. In case, we have a slot provided, use it for initialization. */ - Tcl_ObjSetVar2(interp, paramPtr->nameObj, NULL, newValue, TCL_LEAVE_ERR_MSG|TCL_PARSE_PART1); + + if (paramPtr->slotObj) { + result = NsfCallMethodWithArgs(interp, (Nsf_Object *)object, paramPtr->nameObj, + newValue, 1, NULL, NSF_CSC_IMMEDIATE); + } else { + Tcl_ObjSetVar2(interp, paramPtr->nameObj, NULL, newValue, TCL_LEAVE_ERR_MSG|TCL_PARSE_PART1); + } } }