Skip to content
Tcl Source Code View Ticket
Login

View Ticket

2014-09-10
08:25 • Closed ticket [2486824fff]: "upvar" in global's err msg. plu... artifact: 5d26d6c4d7 user: dkf
08:24
[2486824] Improve error message; not all that upvars is an upvar. check-in: aa55afef99 user: dkf tags: trunk
08:20
[2486824] Improve error message; not all that upvars is an upvar. check-in: f3c64a7a7c user: dkf tags: core-8-5-branch
06:11 • Ticket [2486824fff] "upvar" in global's err msg. status stil... artifact: 21c66067a3 user: aku
05:35 • Ticket [2486824fff]: 8 changes artifact: d07aa4074b user: dkf
2014-09-09
22:48 • Add attachment tv.diff to ticket [2486824fff] artifact: ef265a5e38 user: stwo
2012-07-17
01:12 • Ticket [2486824fff] "upvar" in global's err msg. status stil... artifact: 85e25bbf52 user: stwo
2009-05-01
08:30 • Ticket [2486824fff]: 1 change artifact: 32e51254d4 user: msofer
2009-04-09
22:33 • Ticket [2486824fff]: 4 changes artifact: 3c26566039 user: dgp
2009-04-03
02:38 • Ticket [2486824fff]: 4 changes artifact: 87872e5286 user: dgp
2009-01-05
16:30 • Ticket [2486824fff]: 4 changes artifact: 23be3e033f user: ferrieux
16:25 • Ticket [2486824fff]: 5 changes artifact: bd9275e290 user: dkf
01:42 • New ticket [2486824fff]. artifact: cc6bb7bef4 user: stwo

"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: