Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: 0b9b03a557b75a94a3a8a6afd7f3577363d4b6e5
Ticket: 47ac84309bab4719c58a693f5d63d837887f3b17
more (compiled) lreplace madness
User & Date: aspect on 2015-06-24 13:19:00
Changes

  1. icomment:
    I think it's safe to preserve the compilation of lreplace in simple cases:
    both index arguments known and of the same "sign".  Ferrieux has also
    advised "drastically reducing the ambition of the optimiser" in [44fd4b9a4e].
    I'm very much in agreement that falling back to the interpreted version when it
    gets difficult is the path to sanity.
    
    That, and clearly articulating the various cases.  Which is where it gets
    interesting (see also [44fd4b9a4e]):
    
    
    Compiled lreplace has supported end+1 indexing to append since at least
    8.6.3:
    
    % lreplace a 1 1 b
    a b
    % lreplace a end+1 end+1 b
    a b
    
    This isn't documented or supported by interpreted lreplace, but it seems to
    be useful.  I would like to add this to supported behaviour of [lreplace],
    complete with a decent set of tests and an example in the man page.
    
    
    As an aside, I find the below surprising .. it's documented and consistently
    implemented behaviour, but I cannot understand the motivation.
    
    % lreplace {} 2 2
    
    % lreplace 1 2 2
    list doesn't contain element 2
    
    Perhaps if anyone can come up with a good motivation for the error being
    suppressed for an empty list, I can add that to the manual too.
    
  2. login: "aspect"
  3. mimetype: "text/plain"