Menu

#276 constructor namespace

4.0*
closed-fixed
None
5
2016-01-19
2015-12-23
No

The following script behaves differently in Itcl 3.4 and 4.0.3:

package require Itcl
namespace import itcl::*

class A {
    constructor {} {
        puts [uplevel namespace current]
    }
}

class B {
    inherit A
    constructor {} {}
}

B #auto

In Itcl 3.4, it displays:


In Itcl 4.0.3, it displays:


Discussion

  • Don Porter

    Don Porter - 2015-12-23

    Are those results supposed to be blank?

     
  • Don Porter

    Don Porter - 2015-12-23

    Trying for myself I see that Itcl 3 thinks the uplevel namespace is ::B

    While Itcl 4 thinks it is ::

    This does not appear to be a recent change.

     
  • Tim Tomkinson

    Tim Tomkinson - 2015-12-23

    That is correct. SF deleted the results for some reason.

     
  • Don Porter

    Don Porter - 2016-01-08

    In Itcl 3, compare with:

    % itcl::class C {
        inherit A
    }
    % C #auto
    ::
    c0
    

    We seem to need a constructor in the derived class
    to get that class namespace to show up in the uplevel.

    Any chance we can call this a bug in Itcl 3, fixed in Itcl 4?
    Or is this an important detail that scripts rely on?

     
  • Don Porter

    Don Porter - 2016-01-08

    Found a fix that works interactively, but not in a test suite(?!?!)

    Exploring that is finding more bugs.

     
  • Don Porter

    Don Porter - 2016-01-12

    This matter is part of constructor invocation, and is
    closely related to

    http://core.tcl.tk/itcl/tktview?name=ec215db901

    The same reform will likely fix both problems.

     
  • Don Porter

    Don Porter - 2016-01-19
    • status: open --> closed-fixed
    • assigned_to: Don Porter
     

Log in to post a comment.