Skip to content
Tcl Source Code View Ticket
Login

View Ticket

2024-09-19
09:52
Merge [fc91a7415fd4fd8f]: [680503]: Ensure we make the shadow delegate even if there is no argument ... check-in: af59f0bf1d user: pooryorick tags: unchained, INCOMPATIBLE_LICENSE
2024-09-16
19:08 • Ticket [68050339b5] classmethod fails if no argument supplied to class create</i... artifact: ed774581b6 user: dgp
14:44 • Ticket [68050339b5]: 6 changes artifact: 1f253329f9 user: oehhar
14:44
[680503]: Ensure we make the shadow delegate even if there is no argument to the class constructor. check-in: fc91a7415f user: dkf tags: trunk, main
14:41 • Closed ticket [68050339b5]: classmethod fails if no argument supplied to class c... artifact: 9f7c072dd3 user: dkf
14:39
[680503]: Ensure we make the shadow delegate even if there is no argument to the class constructor. check-in: b378bba6ce user: dkf tags: core-8-branch
14:26 • Ticket [68050339b5] classmethod fails if no argument supplied to class create</i... artifact: 972432032c user: dkf
2024-08-26
12:07 • Ticket [68050339b5]: 3 changes artifact: a262ac6b64 user: apnadkarni
12:07 • New ticket [68050339b5]. artifact: 72027599e2 user: apnadkarni

classmethod fails if no argument supplied to class create

Closed / Fixed68050339b564d3c155cb9d9b324262ed7b3b65f3Created 2 years agoUpdated 2 years ago
Descriptionmarkdown2024-08-26 12:07:16
% oo::class create C
::C
% oo::define C {method m {} {}}
% oo::define C {classmethod cm {} {}}
::oo::Obj23:: oo ::delegate does not refer to an object

Note method works, but not classmethod. On the other hand, if the create is passed a body (even empty), it all works.

% oo::class create D {}
::D
% oo::define D {method m {} {}}
% oo::define D {classmethod cm {} {}}

Very minor but spent a half hour not understanding why my code was suddenly failing after adding a classmethod :-)

apnadkarni Ticket [68050339b5]: 3 changes [History diff]2024-08-26 12:07:33
dkfmarkdown2024-09-16 14:26:21

Very odd. That should work...

dkfmarkdown2024-09-16 14:41:11

Oh, that was silly. Was checking the number of arguments to the class constructor too early. Moved the check after the creation of the delegate.

oehharwiki2024-09-16 14:44:06

Great fix! The commit is [b378bba6ce].

dgpplain2024-09-16 19:08:29
This bug fix applied to Tcl trunk creates three test failures
in Itcl 4.3.0

typeclass.test


==== rename-1.3 rename to "" deletes an instance FAILED
==== Contents of test case:

    type dog { }

    dog fido
    rename fido ""
    namespace children ::dog

---- Result was:
{::dog:: oo }
---- Result should have been (exact matching):

==== rename-1.3 FAILED



==== rename-1.4 rename to "" deletes an instance even after a rename FAILED
==== Contents of test case:

    type dog { }

    dog fido
    rename fido spot
    rename spot ""
    namespace children ::dog

---- Result was:
{::dog:: oo }
---- Result should have been (exact matching):

==== rename-1.4 FAILED



==== destroy-1.1 destroy cleans up the instance FAILED
==== Contents of test case:

    type dog {
        option -color golden
    }

    set a [namespace children ::dog::]
    dog create spot
    set ns [info object namespace spot]
    set b [namespace children ::itcl::internal::variables$ns]
    spot destroy
    set c [namespace which ::itcl::internal::variables$ns]
    list $a $b $c [info commands ::dog::spot]

---- Result was:
{{::dog:: oo }} ::itcl::internal::variables::oo::Obj123::dog {} {}
---- Result should have been (glob matching):
{} ::itcl::internal::variables::*::dog {} {}
==== destroy-1.1 FAILED
Log in (anonymous is fine) to add a comment.