Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: 303c766bb15cbfbb94df72ce99ac4c2e50c2f235
Ticket: 214cc0eb221912366d9bddbf04e660cf155393b9
lappend no-op function changes when compiled
User & Date: dgp on 2014-11-05 06:38:01
Changes

  1. icomment:
    Simplest possible fix committed to trunk: disable compile of the
    inconsistent case.
    
    Leaving open in case dkf wants to pursue actually patching up
    the behavior of all the new bytecode instructions instead.
    
    There's a natural question to be asked here about whether
    [lappend] ought to be always producing canonical lists.  It has
    not been doing so up to now.  The argument in favor is to 
    expand the set of commands one can use to create commands
    for evaluation with complete confidence.
    
    set script "a\nb"
    eval [lappend script {*}$args] ;# one command or two?!
    
    The argument against is that a no-op is best implemented as
    a no-op (but in that case, why are we checking for list-ness?).
    In particular, here a variable is involved and given the chance
    to leave a variable's contents untouched, we should (and avoid
    triggering traces, etc.).
    
    I don't think either case is completely convincing to me, leaving
    me uncertain which is more properly the best behavior to choose.
    In that situation I break the tie by keeping consistency with
    the historical practice.
    
    Other opinions are invited.  In particular examples of existing
    use of [lappend] to produce scripts for evaluation would be
    good to know about, in particular, those combined with {*}
    that might degenerate to the troublesome case.
    
  2. login: "dgp"
  3. mimetype: "text/plain"