Skip to content
Tcl Source Code View Ticket
Login

View Ticket

[dict with] manual page misses special case

Closed / Fixed3474512fffffffffffffffffffffffffffffffffCreated 15 years agoUpdated 15 years ago
Descriptionplain2012-01-16 18:48:39
When a dict key maps to the same variable name used in [dict with], the command fails. This is expected, but not noted in the manual page.
Moreover, the error message is misleading.

% set foo {foo 1 bar 2 baz 3}
foo 1 bar 2 baz 3
% dict get $foo foo
1
% dict with foo {}
missing value to go with key
dkfplain2012-01-17 04:49:13
That's technically incorrect; if foo had mapped to a (sub-)dictionary then it would have "worked" (in as far as anything can be fully working in such a case).

% set foo {foo {a b} bar 2 baz 3}
foo {a b} bar 2 baz 3
% dict get $foo foo
a b
% dict with foo {}
% puts $foo
a b foo {a b} bar 2 baz 3
dkfplain2012-01-17 22:24:29
allow_comments - 1

Added paragraph of explanation and an example
Log in (anonymous is fine) to add a comment.