Tcl Library Source Code

View Ticket
Login
Ticket UUID: fe7a0e0a3a1efe3613eddb6de175b155853f2abc
Title: oo::class.Delegate create conflicts with megawidget.tcl
Type: Bug Version: 1.2
Submitter: anonymous Created on: 2014-09-18 15:23:51
Subsystem: oo::util Assigned To: aku
Priority: 5 Medium Severity: Minor
Status: Closed Last Modified: 2015-06-10 18:12:14
Resolution: Fixed Closed By: aku
    Closed on: 2015-06-10 18:12:14
Description:
% source ${tcllib}/modules/ooutil/ooutil.tcl
% source ${tk}/library/megawidget.tcl
wrong # args: should be "::tk::Megawidget create name ?script?"
    while executing
"::tk::Megawidget create ::tk::SimpleWidget {} {
    variable w hull options
    method GetSpecs {} {
        return {
            {-cursor cursor Cursor {}}
            {-..."
    (file "megawidget.tcl" line 100)
    invoked from within
"source megawidget.tcl"

The offending definition seems to be [1] which conflicts with tk::Megawidget's constructor [2].

This would appear an easy fix if not for the oo::define on line 100, which is decidedly shady.

[1] http://core.tcl.tk/tcllib/artifact/f93e0d204919b02d9a57e268aedc966d41804b28?ln=93-111
[2] http://core.tcl.tk/tk/artifact/fb4d68226f573c9a37badffb3b64f23221ef6031?ln=15-29
User Comments: aku added on 2015-06-10 18:12:14:
Ok, that explains things.
- Confirmed, new test demonstrates problem.
- Confirmed, patch fixes problem, passes new test.
Commit [874cdb3f3f].
Pushed.

Commit [bb0df7cdd1] for the unrelated classmethod tests.
Pushed.

anonymous (claiming to be aspect) added on 2015-06-09 23:42:49:
- I mistakenly made the patch against the "odie" branch:
  it sounds like you managed to clean up and apply it to
  trunk;  if not, let me know and I'll adjust to suit

- the provided tests don't actually excercise this issue
  .. I was lazy.  The following does:


test ooutil-ticket-fe7a0e0a3a {classmethod must not interfere with constructor signatures} -setup {
    oo::class create TestClass {
        superclass oo::class
        self method create {name ignore body} {
            next $name $body
        }
    }
} -body {
    TestClass create okay {} {}
} -cleanup {
    rename TestClass {}
} -result {::okay}

aku added on 2015-06-09 20:12:55:
Hi aspect. I have pulled the patch and attached it to the ticket here.
Testing it I came across a few issues with it, which I hope you can clarify.

The base revision I work with is [d29f257cb9], which is trunk head, currently.

- The change to the ooutil.test file is rejected.
  Looking at the chunk I see pieces of tests which we do not seem to have
  in the repo. It seems that you have more tests in your local version.
  (Would be interested in having these tests)

- I usually try to confirm the problem, and that new test cases demo it,
  and the fix. I was unable to. IOW the new tests succeed even if I only
  add them, without making the change to the oo::class.Delegate. They
  succeed as well when the Delegate change is made. Thus they do not seem
  to demo the problem and I cannot use them to verify the fix.

This second part is the most trouble.

I used Tcl 8.5.18+TclOO 1.0.2, and Tcl 8.6.4 for the testing.
Both Tcl were near-head of their respective branches.

Please have a look at these test-cases.

anonymous (claiming to be aspect) added on 2015-06-09 12:43:20:
The patch at http://paste.tclers.tk/3540 seems to address this issue cleanly .. I didn't see it prior to reading Ashok's wonderful article on TclOO!

Apologies for not including the patch here:  I can't attach files as anonymous, and can't get fossil's ticket formatting to play nice.

anonymous added on 2015-04-30 14:46:16:
I am a different anonymous (I can't figure out how I can register an account here :( ), so unfortunately I don't have a likely fix.

aku added on 2015-04-14 23:22:22:
Pity :(

You mentioned Sep 18 that you had a likely fix.
Can you attach this fix here please?

A self-contained test-case would be good as well.

anonymous added on 2015-03-23 15:59:45:

The fix for [b3577ed586] did not do anything for this issue...


aku added on 2014-09-22 23:29:59:

Applied the fix for ticket [b3577ed586].

This was pushed as oo::util 1.2.1

Please report if that helped with this problem as well.

Note that oo::util has the beginnings of a testsuite now. Any fix for this should have a self-contained testcase we can add to it.


aku added on 2014-09-22 23:29:30:

Applied the fix for ticket [b3577ed586].

This was pushed as oo::util 1.2.1

Please report if that helped with this problem as well.

Note that oo::util has the beginnings of a testsuite now. Any fix for this should have a self-contained testcase we can add to it.


aku added on 2014-09-18 23:10:52:
Ok. When you have the patch please attach it to this ticket.

Please make a small self-contained test case as well, which I can then add to the package's testsuite.

anonymous added on 2014-09-18 22:53:29:
Thanks aku - the linked looks different, but I've identified a likely fix for it :-).

aku added on 2014-09-18 17:41:18:

Duplicate of [b3577ed586], maybe ?

Regardless, I do not know enough of the oo stuff with delegates. This has to go through dkf I believe.


Attachments: