Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: 57c85fd351e8683cabbfdb1146d270f6208f5fbfe7aa671c6850de5f25547588
Ticket: 1017884fffffffffffffffffffffffffffffffff
make 'level' arg to uplevel/upvar mandatory
User & Date: pooryorick on 2020-09-19 15:08:20
Changes

  1. closedate changed to: "2459112.13078874"
  2. closer changed to: "pooryorick"
  3. comment changed to:
    uplevel always converts its first argument into a
    string in order to check if it is the optional ?level?
    argument.  If the optional argument is not present, the
    first argument is converted anyway, which can take
    significant time and loses the benefit of direct list
    evaluation.  
    
    set l [list]
    for {set c 0} {$c < 10000} {incr c} {
        lappend l 12345
    }
    
    proc t1 {l} {
        set cmd [list llength $l]
        uplevel $cmd
    }
    
    proc t2 {l} {
        set cmd [list llength $l]
        uplevel 1 $cmd 
    }
    
    puts [time {t1 $l} 100]
    puts [time {t2 $l} 100]
    
  4. icomment:
    Part of this issue has been fixed in ticket [b9ecf3ce9801c480]:  If a single argument is given and that argument is a list containing more than one item, it can not be a level specification, so it is interpreted as the script to evaluate.  Morever, no string representation is generated.
    
    The part of this issue that requires a TIP, as discussed in [1017884], remains outstanding.
    
  5. login: "pooryorick"
  6. mimetype: "text/x-fossil-wiki"
  7. severity changed to: "Minor"