|Title:||always have a valid frame|
|Submitter:||msofer||Created on:||2006-10-14 17:21:09|
|Subsystem:||45. Parsing and Eval||Assigned To:||msofer|
|Status:||Closed||Last Modified:||2006-10-24 04:42:19|
|Closed on:||2006-10-23 21:42:19|
The patch insures that there are always valid iPtr->varFramePtr and iPtr->framePtr, even at root level. This simplifies the code as the checks for iPtr->varFramePtr==NULL are not needed anymore. It also adds new functionality (currently unused): core calls to Tcl_EvalObjv with TCL_EVAL_INVOKE may set a namespace in which the command lookup is to be performed; if none is requested, the lookup is done at global level as before. The patch hijacks two unused fields from the Interp struct: - char *unused3; /* No longer used (was errorInfo) */ - char *unused4; /* No longer used (was errorCode) */ + CallFrame *rootFramePtr; /* Global frame pointer for this interpreter */ + Namespace *lookupNsPtr; /* Namespace to use ONLY on the next + * TCL_EVAL_INVOKE call to Tcl_EvalObjv */
msofer added on 2006-10-16 19:43:09:
Logged In: YES user_id=148712 Possible alternative implementation of the ns lookup feature: add a flag value TCL_EVAL_IN_NAMESPACE that causes TEOV and TEOVI to interpret objv as a namespace name for lookup? May be cleaner, and easier to expose to extensions.
msofer added on 2006-10-15 20:37:45:
Logged In: YES user_id=148712 The tying-in to TCL_EVAL_INVOKE is just an attempt to minimize the scope of the patch to where it is needed for enabling 1577492, 1577324 and 1577282. It is trivial to avoid tying it in by just using iPtr->lookupNsPtr!=NULL as the signal to use this, as long as TCL_EVAL_GLOBAL is not passed. I do not remember what the problem is with the TEI flag. If it is just the fact that it is a flag that is publicly exposed but not meant to be used outside the core, this also would enable its complete removal: again, let iPtr->lookupNsPtr!=NULL be the way to signal that the TEI behaviour is wanted, with the current behaviour triggered by iPtr->lookupNsPtr==iPtr->globalNsPtr I am somewhat confident that this does not stand in the way of a fix of the TEI issue, even without knowing what the issue actually is. One possible way to explode it: let the current behavior of TEI be separated in: * run in global: set iPtr->lookupNsPtr=iPtr->globalNsPtr * do not trace errors: rename TEI to TCL_EVAL_NO_ERROR, and let it mean just that * do not reset ensemble flags: a new flag value? Or keep it tied to the "run in global" behaviour? Note that TEI is currently exposed in tcl.h but not documented in the man pages, so it is a valid question if any extension is actually using it.
dgp added on 2006-10-15 10:43:14:
Logged In: YES user_id=80530 One possible wrinkle here is that we should really be doing away with, or at least "exploding" the TCL_EVAL_INVOKE flag, if it's the one I suspect it is. This feature might well be suitable for one of its successors.
msofer added on 2006-10-15 00:21:10:
File Added - 198168: varframe.patch