Tcl Source Code

Ticket Change Details
Login
Overview

Artifact ID: 860ba15bc1811f9c02b7ff26d6fd98ac70f033b9
Ticket: d8589a4ec50d0423caa0ee5e0f9603223f08b4e5
Uplevel Failure in Itcl 4.0
User & Date: tomkiti 2013-11-30 15:42:08
Changes

  1. assignee changed to: "nobody"
  2. closer changed to: "nobody"
  3. cmimetype changed to: "text/plain"
  4. comment changed to:
    When "uplevel" is used to call a method in a different class, it reports that the only available methods are from the calling class, not the target class. In the following example, class A calls a method in class B, which uses "uplevel" to call a method in class A:
    
        if {[package vsatisfies [package require Tcl] 8.6]} {
            package require Itcl 4.0
        } else {
            package require Itcl
        }
        namespace import itcl::*
    
        class A {
    
            variable b
    
            constructor {} {
                set b [B #auto]
            }
    
            public method m1 {} {
                $b m3
            }
    
            public method m2 {} {
                puts m2
            }
        }
    
        class B {
    
            public method m3 {} {
                uplevel m2 ;# <--------- Fails in Itcl 4.0
            }
        }
    
        set a [A #auto]
        $a m1
    
    When the above code is run in Tcl8.5.15/Itcl3.4, it correctly displays:
    
        m2
    
    When run in Tcl8.6.1/Itcl4.0b7, it throws an error:
    
        bad option "m2": should be one of...
          b0 cget -option
          b0 configure ?-option? ?value -option value...?
          b0 isa className
          b0 m3
    
    The list of available methods are from class B, not class A. "Uplevel" works correctly with TclOO 1.0.1.
    
  5. foundin changed to: "4.0b7"
  6. is_private changed to: "0"
  7. login: "tomkiti"
  8. priority changed to: "5 Medium"
  9. private_contact changed to: "1c57e67924247fd7926e89348f266c081ec57db2"
  10. resolution changed to: "None"
  11. severity changed to: "Critical"
  12. status changed to: "Open"
  13. submitter changed to: "tomkiti"
  14. subsystem changed to: "81. Bundled Packages"
  15. title changed to: "Uplevel Failure in Itcl 4.0"
  16. type changed to: "Bug"