Skip to content
Tcl Source Code History Of Ticket 1017884fffffffff
Login

History Of Ticket 1017884fffffffff

Artifacts Associated With Ticket 1017884fffffffff

  1. Ticket change [ffa8f2882d] (rid 108787) by dvrsn on 2004-08-27 20:58:44:

    1. assignee initialized to: "msofer"
    2. cmimetype initialized to: "text/plain"
    3. comment initialized 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. foundin initialized to: "None"
    5. priority initialized to: "5 Medium"
    6. resolution initialized to: "None"
    7. status initialized to: "Open"
    8. submitter initialized to: "dvrsn"
    9. subsystem initialized to: "22. [proc] and [uplevel]"
    10. title initialized to: "uplevel can shimmer to string unnecessarily"
    11. type initialized to: "RFE"
  2. Ticket change [7cd415845f] (rid 97144) by msofer on 2004-08-28 04:14:06:

    1. icomment:
      Logged In: YES 
      user_id=148712
      
      My first reaction to this is: always specify the level, do
      not rely on the default!
      
      My second reaction is: how do you think this could be fixed?
      One idea is to assume that, if there is just one argument to
      uplevel and it is a pure list, it has to be a script and we
      could avoid parsing it. But then the following script would
      have a different behaviour:
      
        % proc 1 {} {puts hi}
        % proc a {} {uplevel [list 1]}
        % a
        wrong # args: should be "uplevel ?level? command ?arg ...?"
      
      So now the question is: is this just a performance bug, or a
      real bug? Ie, should that script print "hi" or return an
      error as it does now?
      
      
    2. login: "msofer"
    3. mimetype: "text/plain"
    4. username: "msofer"
  3. Ticket change [dbfec69aee] (rid 108055) by dgp on 2004-08-28 04:29:24:

    1. icomment:
      Logged In: YES 
      user_id=80530
      
      The docs indicate that
      
      [uplevel 1]
      
      ought to be equivalent to
      
      [uplevel 1 1]
      
      It doesn't appear to be true.
      Looks like a bug to me.
      
      Either the docs or the code
      needs correcting.
      
      In practical terms. one should
      always provide an explicit level
      argument to [uplevel] and avoid
      any ambiguity or inefficiency.
      
      
    2. login: "dgp"
    3. mimetype: "text/plain"
    4. username: "dgp"
  4. Ticket change [b7816b512a] (rid 125610) by msofer on 2004-08-28 05:30:55:

    1. closedate changed to: "2004-08-27T22:30:55"
    2. closer changed to: "msofer"
    3. icomment:
      Logged In: YES 
      user_id=148712
      
      dgp later noticed that the docs say that [uplevel 1] is a
      syntax error: 
      "Level cannot be defaulted if the first command argument
      starts with a digit or #."
      
      So: when there is a single argument, its string rep has to
      be examined to check that id does not start with a digit or
      #. The present behaviour is mandated by the docs.
      
      
    4. login: "msofer"
    5. mimetype: "text/plain"
    6. resolution changed to: "Invalid"
    7. status changed to: "Closed"
    8. username: "msofer"
  5. Ticket change [48416cb054] (rid 99853) by msofer on 2004-08-28 05:35:00:

    1. assignee changed to: "nobody"
    2. icomment:
      Logged In: YES 
      user_id=148712
      
      Keeping this as an RFE for making the level argument
      mandatory, both for the performance reasons cited here and
      to avoid possible confusion.
      
      As a first step, the docs could state that omitting the
      'level' argument is deprecated.
      
      
    3. login: "msofer"
    4. mimetype: "text/plain"
    5. resolution changed to: "None"
    6. status changed to: "Open"
    7. subsystem changed to: "None"
    8. title changed to: "make 'level' arg to uplevel/upvar mandatory"
    9. username: "msofer"
  6. Ticket change [3cf531f34d] (rid 121003) by msofer on 2004-08-28 05:36:16:

    1. assignee changed to: "msofer"
    2. subsystem changed to: "22. [proc] and [uplevel]"
  7. Ticket change [da66d8c5df] (rid 107777) by hobbs on 2005-05-31 08:53:41:

    1. closedate changed to: "2005-05-31T01:53:41"
    2. closer changed to: "hobbs"
    3. icomment:
      Logged In: YES 
      user_id=72656
      
      Rejecting this request as impractical due to
      incompatability.  You can file for a doc clarification, but
      you can't just break existing code.
      
      
    4. login: "hobbs"
    5. mimetype: "text/plain"
    6. resolution changed to: "Wont Fix"
    7. status changed to: "Closed"
    8. username: "hobbs"
  8. Ticket change [57c85fd351] (rid 186859) by pooryorick on 2020-09-19 15:08:20:

    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"
  9. Ticket change [c73f614379] (rid 186863) by dgp on 2020-09-19 17:04:08:

    1. closedate changed to: "2459112.21121291"
    2. closer changed to: "dgp"
    3. icomment:
      
      Please also note that the list internal rep implementation has been improved in the many years since this ticket was opened.  A canonical list is recognized now even after a string rep is generated.  The cost of string rep generation now lmited to that actual cost of that processing step.  It no longer disables the benefits of direct evaluation of lists without reparsing as scripts.  That makes this issue far far less important, and that has been true for a very very long time now.
      
    4. login: "dgp"
    5. mimetype: "text/plain"