View gist:5557120
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
# should produce JRANDOM\nELIZABETH\n as output | |
module Foo:auth<JRANDOM> { | |
sub foo is export { say "JRANDOM" }; | |
} | |
module Foo:auth<ELIZABETH> { | |
sub foo is export { say "ELIZABETH" }; | |
} |
View gist:7493850
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
#------------------------------------------------------------------------------- | |
# LFAV - Support module loading with long name/from/auth/version information | |
# | |
# Although the order for specification is usually longname, from, auth and | |
# version (hence the name of the module LFAV), it was deemed more useful to | |
# make "from" the top level hash, to easier allow for shortcuts for different | |
# module sources. | |
constant Unk := Any; | |
constant MAGIC_KEY := "LFAV"; |
View gist:11404980
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
sub term:<1sec>() { Duration.new(1) } | |
sub term:<1second>() { Duration.new(1) } | |
sub term:<1min>() { Duration.new(60) } | |
sub term:<1minute>() { Duration.new(60) } | |
sub term:<1hour>() { Duration.new( 60 * 60 ) } | |
sub term:<1day>() { Duration.new( 24 * 60 * 60 ) } | |
sub term:<1week>() { Duration.new( 7 * 24 * 60 * 60 ) } | |
sub postfix:<secs>($secs) { Duration.new($secs) } | |
sub postfix:<seconds>($seconds) { Duration.new($seconds) } |
View Proxy huh????
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
class A is Hash { | |
method at_key(A:D $hash: $k) { | |
Proxy.new( | |
FETCH => { | |
say "in FETCH with $k"; | |
$hash.exists_key($k) ?? $hash{$k} !! Int; | |
}, | |
STORE => -> $old, $new { | |
if $new > 0 { | |
$hash{$k} = $new; |
View gist:80b8c5b3a02f8a742c0c
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
diff --git a/src/core/BagHash.pm b/src/core/BagHash.pm | |
index 21a35b8..960ea99 100644 | |
--- a/src/core/BagHash.pm | |
+++ b/src/core/BagHash.pm | |
@@ -1,39 +1,31 @@ | |
-my class BagHash does Baggy { | |
+my class BagValue is Int { | |
+ has $!hash; | |
+ has $!key; | |
+ |
View gist:48b2c6e3a246eb9f0e25
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
for ^Inf -> $job { | |
last if state $x; | |
state $tap = signal(SIGINT).tap( { | |
say "\b\bwaiting for job #$job to be done"; | |
$x = True; | |
} ); | |
LAST { $tap.close } | |
my $working = 5.rand; | |
say "job #$job for {$working.fmt('%.2f')} seconds"; |
View gist:2bbcb4f8799f689da1ff
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-j t/spec/S04-phasers/in-loop.rakudo.jvm | |
1..3 | |
Exception in thread "main" org.perl6.nqp.runtime.UnwindException | |
at org.perl6.nqp.runtime.ThreadContext.<init>(ThreadContext.java:119) | |
at org.perl6.nqp.runtime.GlobalContext.getCurrentThreadContext(GlobalContext.java:324) | |
at org.perl6.nqp.runtime.GlobalContext.<init>(GlobalContext.java:239) | |
at org.perl6.nqp.runtime.CompilationUnit.enterFromMain(CompilationUnit.java:56) | |
at perl6.main(gen/jvm/main.nqp) |
View gist:c12ccd3b9812f49188b1
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
# t/spec/foo.t | |
use Test; | |
plan 1; | |
#?rakudo todo 'huh?' | |
throws_like( { die }, X::Comp); | |
============================= |
View gist:72dc142c2aac6b402b64
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
t/spec/S02-literals/radix.rakudo.parrot (Wstat: 0 Tests: 7 Failed: 0) | |
Parse errors: Bad plan. You planned 135 tests but ran 7. | |
t/spec/S02-magicals/DISTRO.rakudo.parrot (Wstat: 0 Tests: 24 Failed: 0) | |
Parse errors: Bad plan. You planned 28 tests but ran 24. | |
t/spec/S02-magicals/KERNEL.rakudo.parrot (Wstat: 256 Tests: 32 Failed: 1) | |
Failed test: 29 | |
Non-zero exit status: 1 | |
t/spec/S02-magicals/VM.rakudo.parrot (Wstat: 0 Tests: 29 Failed: 0) | |
Parse errors: Bad plan. You planned 32 tests but ran 29. | |
t/spec/S02-names/is_cached.t (Wstat: 512 Tests: 38 Failed: 2) |
View gist:65d9e44743dffca1157c
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
# ./Foo.pm | |
my sub EXPORT(*@a) { | |
say "in EXPORT"; | |
( '$*FOO' => ++state $ ).hash; | |
} | |
============== works as expected | |
$ perl6 -I. -e 'use Foo; say $*FOO; { use Foo; say $*FOO }; say $*FOO' | |
in EXPORT |
OlderNewer