Tcl Source Code

View Ticket
Login
Ticket UUID: cb042d294ec00c41ecf0aa77a8e050183cd9ac6a
Title: [dict] "wrong # args" error inconsistencies
Type: Bug Created on: 2014-05-21 23:56:38
Submitter: andy Assigned to: dkf
Subsystem: 15. Dict Object Severity: Minor
Priority: 5 Medium Last modified: 2014-06-15 16:50:51
Status: Closed Closed by: dkf
Resolution: Fixed Closed on: 2014-06-15 16:50:51
Version: cdc4e05235717e4959d745e4cc6670bd1333c783
Description:
% dict append
wrong # args: should be "dict append varName key ?value ...?"
% dict incr
wrong # args: should be "dict incr varName key ?increment?"
% dict lappend
wrong # args: should be "dict lappend varName key ?value ...?"
% dict set
wrong # args: should be "dict set varName key ?key ...? value"
% dict unset
wrong # args: should be "dict unset varName key ?key ...?"
% dict update
wrong # args: should be "dict update varName key varName ?key varName ...? script"
% dict with
wrong # args: should be "dict with dictVar ?key ...? script"

[dict with] is clearly the odd man out, being the only command to say "dictVar" instead of "varName".  It must be following the example of [dict for] and [dict map] which also say "somethingVar" (and should probably say "somethingVarName"):

% dict for
wrong # args: should be "dict for {keyVar valueVar} dictionary script"
% dict map
wrong # args: should be "dict map {keyVar valueVar} dictionary script"

Back to [dict update].  It says "varName" multiple times.  I suggest changing all but the first instance to "valueVarName".

wrong # args: should be "dict update varName key varName ?key varName ...? script"
User Comments:
dkf added on 2014-06-15 16:50:51:

The most useful wording would actually be dictVarName in error messages (and dictionaryVariable on the manual page). What's more, for the places where iterators write variables, a consistent naming scheme (keyVarName valueVarName) is similarly a good idea.