# New Ticket Created by Stephane Payrard # Please include the string: [perl #59202] # in the subject line of all future correspondence about this issue. # <URL: http://rt.perl.org/rt3/Ticket/Display.html?id=59202 >
class names is now (always) a ResizableStringArray so we get a crash instead of printing an error message. rakudo > class A::A {} ; class A::A {}; Class A::A already registered! To be on the safe side, the code supports the old format. Note that there is still a problem to be solved. > class A::A {} ; class A::A {}; Class A::A already registered! > class A::A {} compilers/imcc/pbc.c:1734: failed assertion 'sig_arr->vtable->base_type == enum_class_FixedIntegerArray' In the process of investigating this bug, I added a get_string method to ResizableStringArray that may useful in its own right. --- src/oo.c.orig 2008-09-22 16:59:06.000000000 +0200 +++ src/oo.c 2008-09-22 17:12:36.000000000 +0200 @@ -603,10 +603,12 @@ static void fail_if_type_exists(PARROT_INTERP, ARGIN(PMC *name)) { - INTVAL type; + INTVAL type; + STRING * classname; - PMC * const classname_hash = interp->class_hash; - PMC * const type_pmc = (PMC *)VTABLE_get_pointer_keyed(interp, + STRING * const separator = string_from_cstring(interp, "::", 0); + PMC * const classname_hash = interp->class_hash; + PMC * const type_pmc = (PMC *)VTABLE_get_pointer_keyed(interp, classname_hash, name); if (PMC_IS_NULL(type_pmc) @@ -615,10 +617,15 @@ else type = VTABLE_get_integer(interp, type_pmc); - if (type > enum_type_undef) + if (type > enum_type_undef) { + if (name->vtable->base_type == enum_class_ResizableStringArray) + classname = string_join( interp, separator, name); + else + classname = string_escape_string(interp, VTABLE_get_string(interp, name)); + Parrot_ex_throw_from_c_args(interp, NULL, EXCEPTION_INVALID_OPERATION, - "Class %Ss already registered!\n", - string_escape_string(interp, VTABLE_get_string(interp, name))); + "Class %Ss already registered!\n", classname); + } if (type < enum_type_undef) Parrot_ex_throw_from_c_args(interp, NULL, EXCEPTION_INVALID_OPERATION, -- cognominal stef