# New Ticket Created by  Simon Glover 
# Please include the string:  [perl #33103]
# in the subject line of all future correspondence about this issue. 
# <URL: http://rt.perl.org:80/rt3/Ticket/Display.html?id=33103 >



 This code snippet:

     newclass P0, "City"
     subclass P1, P0, "New York"
     newclass P2, "State"
     subclass P3, P2, "New York"

 fails with the error message:

   Class New York already registered!

 This is fair enough, I suppose -- it's reasonable to mandate that the
 compiler generating the code should pass the fully qualified name of the
 subclass to the subclass op (e.g. 'City::New York'), rather than relying
 on parrot to do this (I don't see this documented anywhere, but I only
 skimmed through the docs, so I may have missed it). However, if we
 want to create an anonymous subclass, using the 2-argument form of the
 subclass op, then we hit a problem -- the code:

     newclass P0, "City"
     subclass P1, P0
     newclass P2, "State"
     subclass P3, P2
     end

 also fails, with the error:

     Class  already registered!

 (NB. Note the double space between 'Class' and 'already'). This occurs
 because the 2-arg subclass op. creates a class with a classname that
 is the null string, so both anonymous subclasses above have the same
 name. This, however, makes this form of the op almost totally useless,
 as we can never use it more than once per program!

 Am I missing some subtlety somewhere, or is this just broken? If the
 latter, how do we fix it -- remove the 2-arg form of the op, on the
 grounds that it's useless, or change how subclass generates
 classnames for anonymous subclasses? [*].

 Incidentally, although the example above uses subclass_p_p, the same
 bug is present if we use subclass_p_s instead, as one would expect.

 Simon

 [*] Yes, I know this sounds odd, but we need to be able to distinguish
 between an anonymous subclass of Foo and an anonymous subclass of Bar,
 which implies it must have some kind of name beyond ''.



Reply via email to