Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: bf289603582eb10541be6077561a0b8ed878dd7e
Ticket: 1718580fffffffffffffffffffffffffffffffff
[lindex] accepts bad index
User & Date: lars_h on 2007-05-14 12:21:25
Changes

  1. assignee changed to: "dkf"
  2. cmimetype changed to: "text/plain"
  3. comment changed to:
    Mistyping [lindex] where I meant [linsert], I discovered the following behaviour:  [lindex {} end foo] does not throw an error, whereas [lindex {} foo] does! Or as an example session:
    
    % info patchlevel
    8.5a6
    % lindex {} foo
    bad index "foo": must be integer?[+-]integer? or end?[+-]integer?
    % lindex {} end foo
    % lindex a end foo
    bad index "foo": must be integer?[+-]integer? or end?[+-]integer?
    % lindex {} 0 foo
    % lindex {} -1 foo
    % lindex {} foo foo
    bad index "foo": must be integer?[+-]integer? or end?[+-]integer?
    
    This is probably due to lines 1108-1115 of tclListObj.c (v 1.46): once an out-of-bounds index is encountered, remaining indices are ignored. Indeed,
    
    % lindex a 1 foo
    % lindex a 0 foo
    bad index "foo": must be integer?[+-]integer? or end?[+-]integer?
    % lindex a -1 foo
    
    
    
  4. foundin changed to: "obsolete: 8.5a6"
  5. is_private changed to: "0"
  6. priority changed to: "5 Medium"
  7. resolution changed to: "None"
  8. status changed to: "Open"
  9. submitter changed to: "lars_h"
  10. subsystem changed to: "17. Commands I-L"
  11. title changed to: "[lindex] accepts bad index"
  12. type changed to: "Bug"