Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: 442b482f473d052adaba5ff381082c87a9f56b5c1c5ff46f5851d52dd7ca7947
Ticket: 27520c9b17116d8d34c1874e4e9ec9d350ad579e
try/finally bytecode optimizer incorrect order of operations
User & Date: andy on 2022-04-21 21:30:47
Changes

  1. assignee changed to: "nobody"
  2. closer changed to: "nobody"
  3. cmimetype changed to: "text/plain"
  4. comment changed to:
    There appears to be a problem with the bytecode optimizer for [try].  If the argument after "finally" contains substitutions, they are not evaluated until it actually comes time to execute the "finally" block.
    
    Consider:
    
    try {puts a} finally [puts b]
    
    This should print "b a" (newline in between) because the [puts b] needs to be evaluated in the process of assembling the command line, before even executing it.  However, it prints "a b" instead.
    
    If the command line is instead written:
    
    {*}[list] try {puts a} finally [puts b]
    
    it prints "b a" as expected.  This is because the bizarre invocation of [list] bypasses the bytecode optimizer, allowing the normal Tcl order of operations to prevail.
    
  5. foundin changed to: "8.6.12"
  6. is_private changed to: "0"
  7. login: "andy"
  8. priority changed to: "5 Medium"
  9. private_contact changed to: "662c23482b0bf6a505f39e48fb7ad43af8dee4d3"
  10. resolution changed to: "None"
  11. severity changed to: "Severe"
  12. status changed to: "Open"
  13. submitter changed to: "andy"
  14. subsystem changed to: "47. Bytecode Compiler"
  15. title changed to:
    try/finally bytecode optimizer incorrect order of operations
    
  16. type changed to: "Bug"