From: SourceForge.net <no...@so...> - 2003-11-10 15:33:38
|
Bugs item #600812, was opened at 2002-08-27 10:26 Message generated for change (Comment added) made by dgp You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=110894&aid=600812&group_id=10894 Category: 07. Variables Group: = 8.4b3 Status: Open Resolution: None Priority: 8 Submitted By: Don Porter (dgp) Assigned to: Don Porter (dgp) Summary: upvar can create unusable variable Initial Comment: set scalar test array set array {foo bar} upvar 0 scalar array(grok) set array(grok) => can't read "array(grok)": no such element in array A scalar (link) variable named "array(grok)" has been created, but there is no mechanism at the script level for doing anything with it. Seems [upvar] should fail rather than give something that can't be used. ---------------------------------------------------------------------- >Comment By: Don Porter (dgp) Date: 2003-11-10 10:33 Message: Logged In: YES user_id=80530 It seems this misfeature is documented in upvar.n, and has been documented this way "forever" (since at least Tcl 7.4). Makes me wonder whether this made sense at one pont, and variable parsing rules have changed over the years to more aggressively recognize arrays? Seems we ought to have a brief TIP, if only to let the wise old men have a look and confirm we're not overlooking something. Otherwise, the patch looks fine. If it's not too much trouble, I'd update your new tests to use the -returnCodes option. You might also want to note in your new code in ObjMakeUpvar that your detection of a bad name for a scalar is consistent (and must remain consistent) with the code in TclObjLookupVar (currently line 447). ---------------------------------------------------------------------- Comment By: miguel sofer (msofer) Date: 2003-11-09 20:52 Message: Logged In: YES user_id=148712 Attaching a patch for review - in particular, the doc changes. This does not require a TIP, does it? ---------------------------------------------------------------------- Comment By: miguel sofer (msofer) Date: 2003-10-20 18:12 Message: Logged In: YES user_id=148712 Failure it will be; creating the array is quite a modification ... ---------------------------------------------------------------------- Comment By: miguel sofer (msofer) Date: 2003-10-20 18:09 Message: Logged In: YES user_id=148712 Duplicated as 826708 by rmax; initial comment there: " As discussed with dkf on the Tcl'ers chat... It works as documented, and treats b(c) as a literal variable name (not as an array). But because this variable can never be accessed with [set] or $-substitution, [upvar] should rather fail on such variable names, or (IMHO better) it should create an array element, if that's possible at all." ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=110894&aid=600812&group_id=10894 |