Skip to content
Tcl Source Code View Ticket
Login

View Ticket

2013-03-19
20:31 • Closed ticket [3525469fff]: lindex with empty index bug plus 7 other chang... artifact: ae37184c43 user: dgp
2012-05-10
16:04 • Ticket [3525469fff]: 1 change artifact: e016983e72 user: dkf
08:59 • New ticket [3525469fff]. artifact: 8fc99ca7d1 user: sebres

[lindex] with empty index bug

Closed / Invalid3525469fffffffffffffffffffffffffffffffffCreated 15 years agoUpdated 14 years ago
Descriptionplain2012-05-10 08:59:38
lt. documentation [lindex] could be executed with empty index.
But if additional index arguments are supplied, it fails with error "bad index".
It's not consistent for following "alternative" lines, if any of $a, $b or $c is empty:
    [lindex [lindex [lindex $l $a] $b] $c] - always success
is not compatible with 
    [lindex $l $a $b $c]  - may fails
or with 
    [lindex $l [list $a $b $c]]  - may fails

Example:
% lindex list {}
list
% lindex [lindex list {}] 0
list
% lindex list {} 0
bad index "": must be integer?[+-]integer? or end?[+-]integer?
dkf Ticket [3525469fff]: 1 change [History diff]2012-05-10 16:04:56
dgpplain2013-03-19 20:31:40
allow_comments - 1

[lindex] supports a single index list argument,
or an arbitrary number of index arguments.
It doesn't permit a mixture of the two.
Log in (anonymous is fine) to add a comment.