Tcl Library Source Code

View Ticket
Login
Ticket UUID: b3577ed586076c7eb7bfc380477629a3fe603479
Title: Requiring oo::util breaks superclass command
Type: Bug Version: 1.2
Submitter: anonymous Created on: 2013-06-28 21:28:58
Subsystem: oo::util Assigned To: aku
Priority: 8 Severity: Critical
Status: Closed Last Modified: 2014-09-22 23:25:32
Resolution: Fixed Closed By: aku
    Closed on: 2014-09-22 23:25:32
Description:
Consider the following script.  If I uncomment the "package require oo::util" line, then when I try to create "dog" I get the error that "pet does not refer to an object".  It would appear that oo::util is capturing the definition script, and getting the namespace wrong. 

I'm using version 1.2 of oo::util with version 1.0 of TclOO under Tcl 8.5.14.

package require TclOO
# package require oo::util


oo::class create animal { }

namespace eval ::projectlib::test {
    oo::class create pet {
        superclass animal
    }

    oo::class create dog {
        superclass pet
    }
}
User Comments: aku added on 2014-09-22 23:25:32:
Fix committed to revision [14faa92003].
Pushed.
Version bumped to 1.2.1.

Thank you for the report, and apologies for the oh so long delay in making the fix.

anonymous added on 2014-09-18 22:37:54:
Seems to be fixed by changing line 100 of ooutil.tcl:

-       oo::define $cls $script
+       uplevel 1 [list oo::define $cls $script]

This is not related to http://core.tcl.tk/tcllib/tktview/fe7a0e0a3a though that bug is stymied by the same line of code.

aku added on 2013-07-04 16:47:39:
Some discussion in email points to the code implementing the 'classmethod' utility, which adds a special mixin into the main oo::class structure.

An 'uplevel' might have been forgotten. Under test.