Subject: | ClassName constraint for a package with empty ISA is inconsistent with Type::Tiny |
When a package has an ISA declared but doesn't have any entries, the ClassName constraint from Type::Tiny (PP implementation) is true, however, the XS version is not.
PERL_TYPE_TINY_XS=0 perl -MTypes::Standard=is_ClassName -le '{package Foo;our @ISA} print is_ClassName("Foo") ? "Class" : "Not Class"'
Show quoted text
> Class
PERL_TYPE_TINY_XS=1 perl -MTypes::Standard=is_ClassName -le '{package Foo;our @ISA} print is_ClassName("Foo") ? "Class" : "Not Class"'
Show quoted text> Not Class
After some digging it turns out the XS version checks @ISA size as well - excerpt from typetiny_is_class_loaded in Util.xs :
if (( gvp = (GV**)hv_fetchs(stash, "ISA", FALSE) )) {
if(isGV(*gvp) && GvAV(*gvp) && av_len(GvAV(*gvp)) != -1){
return TRUE;
}
}
I'm not sure which was the correct one and which is the bug but at the very least they should behave the same.