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.