Created
June 7, 2011 08:46
-
-
Save moritz/1011914 to your computer and use it in GitHub Desktop.
Attempt to implement Int.succ
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
./perl6 -e '1.succ' | |
Null PMC access in invoke() | |
current instr.: '_block1728' pc 63102 (src/gen/CORE.setting.pir:17658) (:191) | |
... call repeated 1 times | |
called from Sub '_block13' pc 75 ((file unknown):55) (:1) | |
called from Sub '_block11' pc 14 ((file unknown):12) (:1) | |
called from Sub 'nqp;HLL;Compiler;_block1712' pc 36954 (src/stage2/gen/NQPHLL.pir:0) | |
called from Sub 'nqp;HLL;Compiler;eval' pc 36815 (src/stage2/gen/NQPHLL.pir:11476) | |
called from Sub 'nqp;HLL;Compiler;command_line' pc 38009 (src/stage2/gen/NQPHLL.pir:11935) | |
called from Sub 'MAIN' pc 926 (src/gen/perl6.pir:256) | |
called from Sub '_block11' pc 96 (src/gen/perl6.pir:56) | |
XXX Multi error reporting busted.. | |
./perl6 -e 'Int.succ' | |
Null PMC access in invoke() | |
current instr.: '_block1728' pc 63102 (src/gen/CORE.setting.pir:17658) (:191) | |
... call repeated 1 times | |
called from Sub '_block13' pc 74 ((file unknown):55) (:1) | |
called from Sub '_block11' pc 14 ((file unknown):12) (:1) | |
called from Sub 'nqp;HLL;Compiler;_block1712' pc 36954 (src/stage2/gen/NQPHLL.pir:0) | |
called from Sub 'nqp;HLL;Compiler;eval' pc 36815 (src/stage2/gen/NQPHLL.pir:11476) | |
called from Sub 'nqp;HLL;Compiler;command_line' pc 38009 (src/stage2/gen/NQPHLL.pir:11935) | |
called from Sub 'MAIN' pc 926 (src/gen/perl6.pir:256) | |
called from Sub '_block11' pc 96 (src/gen/perl6.pir:56) | |
XXX Multi error reporting busted... |
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
$ git diff | |
diff --git a/src/CORE.setting/Int.pm b/src/CORE.setting/Int.pm | |
index db04bf5..f4054a8 100644 | |
--- a/src/CORE.setting/Int.pm | |
+++ b/src/CORE.setting/Int.pm | |
@@ -17,5 +17,9 @@ my class Int { | |
method chr() { | |
pir::perl6_box_str__PS(pir::chr(pir::repr_unbox_int__IP(self))); | |
} | |
+ | |
+ proto method succ(|$) {*} | |
+ multi method succ(Int:D) { self + 1 } | |
+ multi method succ(Int:U) { 1 } | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment