Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: 84bda65dfb45e5cd0f5b42dd8e23430e902d2ad1b60c1738546c3567c823c72f
Ticket: db36fa5122259be74d0ccadd102e076094703052
compiled lindex botches index artihmetic
User & Date: sebres on 2018-03-06 20:31:35
Changes

  1. icomment:
    Still one inconsistency round about indices by lreplace:
    
    Negative out of range (before start) is allowed. 
    Positive out of range (after end) is disallowed.
    
    % lreplace {a b c d} end-10 end-9
    a b c d
    % lreplace {a b c d} -3 -2
    a b c d
    
    % lreplace {a b c d} 6 7
    list doesn't contain element 6
    % lreplace {a b c d} end+2 end+3
    list doesn't contain element end+2
    
    But it allows exactly +1 after end:
    
    % lreplace {a b c d} end+1 end+3
    a b c d
    
    Which is IMHO wrong and at least inconsistent at all.
    
    Rather it should throw an error in both cases, or (I prefer it) it should ignore out of range (in both cases also).
    
    I assume it is not really a bug, but if it is feature, then IMHO very-very questionable.
    
  2. login: "sebres"
  3. mimetype: "text/plain"