Tcl Source Code

View Ticket
Login
Bounty program for improvements to Tcl and certain Tcl packages.
Tcl 2019 Conference, Houston/TX, US, Nov 4-8
Send your abstracts to [email protected]
or submit via the online form by Sep 9.
Ticket UUID: b9ecf3ce9801c480620f83b34110f808bd11affb
Title: [uplevel $list], [uplevel 1 $list] and generation of string representations
Type: Bug Version: 8.6.5
Submitter: pooryorick Created on: 2016-05-05 04:11:20
Subsystem: 18. Commands M-Z Assigned To: nobody
Priority: 5 Medium Severity: Minor
Status: Open Last Modified: 2016-05-05 04:11:20
Resolution: None Closed By: nobody
    Closed on:
Description:

The following script causes a string representation to be generated for each item in the list passed to uplevel, but if a level specifier is added as the first argument to uplevel, string representations aren't generated:

apply {{} {
    uplevel [list apply {{args} {
        foreach arg $args {puts [::tcl::unsupported::representation $arg]}
    }} {*}[list [expr 1] [expr 2]]]
}}

The generation of string representations for items in such a list could have a significant unexpected performance/memory impact.

Ticket 1017884 is related, but this one-argument case could probably be fixed without the backward-incompatible change suggested in that ticket, since the single argument can be assumed to be the script to be evaluated.