Stories
Slash Boxes
Comments
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

use Perl Log In

Log In

[ Create a new account ]

philcrow (3401)

philcrow
  (email not shown publicly)

Journal of philcrow (3401)

Saturday June 02, 2007
09:13 AM

Emitting a Perl 6 role

[ #33406 ]

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

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
 Full
 Abbreviated
 Hidden
More | Login | Reply
Loading... please wait.