Another question about pdd15...:

If I'm in a different HLL namespace (e.g., via a .HLL directive), how do
I get a PMC class from the 'parrot' HLL namespace?

Here is an example (which obviously won't work):  I'm creating a
'perl6;Str' class and then attempting to add (parrot's) String class
as a parent.  But of course the constant 'String' here refers to
the wrong HLL namespace:

    $ cat z.pir
    .HLL "perl6", ""
    
    .namespace [ "" ]
    
    .sub main :main
        # create 'Str' class
        $P1 = new 'Class'
        $P1.'name'('Str')
    
        # add parrot;String PMC as a parent class
        $P2 = get_class 'String'
        addparent $P1, $P2
    .end

    $ ./parrot z.pir
    Class 'String' doesn't exist
    current instr.: 'perl6;;main' pc 12 (z.pir:11)
    $

Of course, I'm mostly interested in knowing what the answer "should be", but I'm
also interested in what "works today".

Pm

Reply via email to