"upvar" in [global]'s err msg.
Closed / Fixed2486824fffffffffffffffffffffffffffffffffCreated 18 years agoUpdated 12 years ago
Descriptionplain2009-01-05 01:42:54
% namespace eval n { proc p {} { global a(b) }; p }
bad variable name "a(b)": upvar won't create a scalar variable that looks like an array element
dkfplain2009-01-05 16:25:09
I suggest just getting rid of the word "upvar" from that message.
ferrieuxplain2009-01-05 16:30:16
Agreed, since the overall style of error messages is to omit the command name, and being smart about it involves an ugly switch on the flags parameter in the common code. For consistency we might do the same to 'upvar won't create namespace variable that refers to procedure variable' even though, by accident, this message occurs in more constrained contexts. Don't forget the three tests to update accordingly :-)
dgpplain2009-04-03 02:38:05
Another reason it's generally a bad idea to include a command name in an error message is that Tcl commands can be [rename]d. Let the error message describe the error only; leave it to -errorinfo to describe the context.
dgpplain2009-04-09 22:33:41
Note also this apparent inconsistency:
% proc demo {} {global a(k)}
% demo
bad variable name "a(k)": upvar won't create a scalar variable that looks like an array element
% global a(k)
%
I would think that varNames that look like
array elements ought to be always forbidden
as arguments to [global].
msofer Ticket [2486824fff]: 1 change
[History diff]2009-05-01 08:30:09
stwoplain2012-07-17 01:12:47
Are we going anywhere with this?
dkfhtml2014-09-10 05:35:15
Looks like the right sort of thing.
akuplain2014-09-10 06:11:41
Agreed. I sort of remember that this was ok in some past version, possibly in the 8.4 cycle, and then was changed to this error. Because a scalar looking like an array element was simply all sorts of pain. I vote for getting rid of the word "upvar" from the generated message.
dkfhtml2014-09-10 08:25:40
Sorted on 8.5 and 8.6 branches
Log in (anonymous is fine) to add a comment.
Attachments:
- tv.diff [download] added by stwo on 2014-09-09 22:48:37. [details]