Itcl - the [incr Tcl] extension

Ticket Change Details
Login
Overview

Artifact ID: bc1b7d8b43d1821bf759bf9dc39c441e5364acd6387aedf9c9727597c1c64027
Ticket: 15f7db53b9f36d978ce732685ac868ee06fbb216
Different behavior for Itcl 4 and Itcl 3
User & Date: anonymous 2018-03-17 20:52:42
Changes

  1. foundin changed to: "4.1.1"
  2. icomment:
    Hi! Appears that the following code behaves differently in Itcl 3 and 4:
    
    itcl::class a {
        constructor {args} {}
        public method a {}
    }
    
    itcl::body a::constructor {args} {
        puts "a::constructor $args"
        b ::newb
    }
    
    itcl::body a::a {} {
        puts "a::a"
    }
    
    itcl::class b {
        constructor {args} {}
    }
    
    itcl::body b::constructor {args} {
        puts "b::constructor $args"
        a::a
    }
    
    a newa
    
    (it's a minimal example which reproduces the problem). Specifically, in Itcl 3 the code works fine and prints
    
    a::constructor 
    b::constructor 
    a::a
    
    but in Itcl 4 it emits the error:
    
    a::constructor 
    b::constructor 
    bad option "a": should be one of...
      newb cget -option
      newb configure ?-option? ?value -option value...?
      newb isa className
        while executing
    "a::a"
        while constructing object "::newb" in ::b::constructor (body line 4)
        invoked from within
    "::itcl::parser::handleClass b ::b ::newb"
        invoked from within
    "b ::newb"
        while constructing object "::newa" in ::a::constructor (body line 4)
        invoked from within
    "::itcl::parser::handleClass a ::a newa"
        invoked from within
    "a newa"
        (file "test.tcl" line 28)
    
    For some reason a::a tries to find method a in class b and fails.
    
  3. login: "anonymous"
  4. mimetype: "text/x-fossil-plain"
  5. private_contact changed to: "07bcf89c4057d2d0e00473ab972eef3274af2d93"
  6. severity changed to: "Important"
  7. status changed to: "Open"
  8. title changed to: "Different behavior for Itcl 4 and Itcl 3"
  9. type changed to: "Code_Defect"