Created
July 6, 2013 12:48
-
-
Save sorear/5939789 to your computer and use it in GitHub Desktop.
how ugly can we make a callback demo?
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
my %gc := nqp::jvmbootinterop('org.perl6.nqp.runtime.GlobalContext'); | |
my %thr := nqp::jvmbootinterop('java.lang.Thread'); | |
my %bji := nqp::jvmbootinterop('org.perl6.nqp.runtime.BootJavaInterop'); | |
my %cls := nqp::jvmbootinterop('java.lang.Class'); | |
my $gc_get_bji := %gc<getfield:bootInterop;Lorg/perl6/nqp/runtime/BootJavaInterop;>; | |
my $bji_implement := %bji<method:implementClass(Lorg/perl6/nqp/sixmodel/SixModelObject;Lorg/perl6/nqp/runtime/ThreadContext;)Lorg/perl6/nqp/sixmodel/SixModelObject;>; | |
my $cls_new := %cls<method:newInstance()Ljava/lang/Object;>; | |
my $thr_run := %thr<method:start()V>; | |
$thr_run( | |
$cls_new( | |
$bji_implement( | |
$gc_get_bji( | |
nqp::null(), # current GC | |
), | |
[ ['extends','java.lang.Thread'], ['instance_method', 'run', '()V', method () { say("Hello thread") }] ], | |
nqp::null(), # current TC | |
), | |
), | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment