Emitting a Perl 6 role

philcrow on 2007-06-02T14:13:47

I have begun work on the last of the three steps in converting Java APIs to Perl 6 roles: emitting Perl 6. Now I have a method of turning this:

public interface IntTest {
    public static final int USELESS_CONSTANT = 4;
    public abstract int[][] array_returner(
        java.lang.String s, int i, float[] f, float[][] g
    );

    public abstract java.lang.String object_returner()
        throws java.lang.NumberFormatException, java.lang.Exception;
    public abstract java.lang.String object_returner( java.lang.String s )
        throws java.lang.NumberFormatException;

    public abstract void void_returner( int i );
}

Into:

# This file was automatically generated Sat Jun  2 09:06:47 2007# by java2perl6 0.1 from decompiling
# IntTest using command line flags:
#   --classpath testjavas

role IntTest {

    method array_returner(
        Str v1,
        Int v2,
        Array of Num v3,
        Array of Array of Num v4,
    ) returns Array of Array of Int { ... }

    multi method object_returner(
    ) returns Str { ... }

    multi method object_returner(
        Str v1,
    ) returns Str { ... }

    method void_returner(
        Int v1,
    )  { ... }

}

Some work remains. I need to finish the command line tool to smoothly make translations like the above. I need to make sure that classes work as well as interfaces. Some documentation is also essential but absent.

Phil