Skip to content
Tcl Source Code View Ticket
Login

View Ticket

2010-08-15
23:16 • Closed ticket [3045010fff]: apply: overlong "wrong # args" error... artifact: d32189153b user: dkf
18:12 • Ticket [3045010fff]: 1 change artifact: c9376d4347 user: dkf
08:34 • Ticket [3045010fff]: 1 change artifact: 255f6c7abe user: andygoth
2010-08-14
18:36 • New ticket [3045010fff]. artifact: 034a12ea47 user: andygoth

[apply]: overlong "wrong # args" error

Closed / Fixed3045010fffffffffffffffffffffffffffffffffCreated 16 years agoUpdated 16 years ago
Descriptionplain2010-08-14 18:36:49
[apply]'s "wrong # args" error message is impractically long, because it contains the full lambda.  I imagine this is a consequence of using Tcl_WrongNumArgs() with objc=2.  For example:

apply {{msg rep} {
    for {set i 0} {$i < $rep} {incr i} {
        puts $msg
    }
}}

gives the error:

wrong # args: should be "apply {{msg rep} {
    for {set i 0} {$i < $rep} {incr i} {
        puts $msg
    }
}} msg rep"

I suggest omitting the lambda, since the only relevant part (the parameter list) is repeated at the end of the error anyway.  In my example, this would be simply:

wrong # args: should be "apply lambdaExpr msg rep"
andygoth Ticket [3045010fff]: 1 change [History diff]2010-08-15 08:34:10
dkf Ticket [3045010fff]: 1 change [History diff]2010-08-15 18:12:56
dkfplain2010-08-15 23:16:55
allow_comments - 1

fixed on HEAD and 8.5 branch
Log in (anonymous is fine) to add a comment.