This file contains hidden or 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
use QASTNodesMoar; | |
# An op | |
my $op := QAST::Op.new(); | |
$op.op('null'); | |
$op.named('foo'); | |
# An SVal | |
my $sval := QAST::SVal.new(); | |
$sval.value('no lol'); |
This file contains hidden or 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
use QASTNodesMoar; | |
my @ops; | |
while 1 { | |
my %h; | |
%h<op> := 'null'; | |
%h<named> := 'foo'; | |
my $op := QAST::Op.new(|%h); | |
nqp::push(@ops, $op); | |
next; |
This file contains hidden or 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
grammar Bug { | |
token TOP { ^ 'foo;' <.ws> $ } | |
token ws { | |
[ | |
| \v+ | |
| '#' \N* | |
| \h+ | |
]* | |
} |
This file contains hidden or 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 @hunters; | |
for 1..4 -> $n { | |
@hunters.push(async { loop { last if (1..1000000).pick == 42 }; $n }) | |
} | |
await Promise.anyof(@hunters); | |
say "Hunter " ~ @hunters.first(*.has_result).result ~ " got there first"; |
This file contains hidden or 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 $found = 0; | |
my $p10000 = async { (1..*).grep({ .is-prime && ++$found })[9999] }; | |
loop { | |
say "Working ($found)..."; | |
await Promise.anyof($p10000, Promise.sleep(1)); | |
last if $p10000.has_result; | |
} | |
say $p10000.result; |
This file contains hidden or 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/Perl6/Metamodel/BOOTSTRAP.nqp b/src/Perl6/Metamodel/BOOTSTRAP.nqp | |
index 0e1e301..0f77155 100644 | |
--- a/src/Perl6/Metamodel/BOOTSTRAP.nqp | |
+++ b/src/Perl6/Metamodel/BOOTSTRAP.nqp | |
@@ -1833,15 +1833,15 @@ Perl6::Metamodel::ParametricRoleGroupHOW.set_selector_creator({ | |
Perl6::Metamodel::ParametricRoleGroupHOW.pretend_to_be([Cool, Any, Mu]); | |
Perl6::Metamodel::ParametricRoleGroupHOW.configure_punning( | |
Perl6::Metamodel::ClassHOW, | |
- hash( ACCEPTS => Mu )); | |
+ hash( ACCEPTS => Mu, item => Mu )); |
This file contains hidden or 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
say "Creating a couple of threads..."; | |
my $t1 = Thread.start({ sleep 1; say "Thread 1 done"; }); | |
my $t2 = Thread.start({ sleep 2; say "Thread 2 done"; }); | |
say "Waiting for joins..."; | |
.join for $t1, $t2; | |
say "Joined!"; | |
say "---"; |
This file contains hidden or 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/Any.pm b/src/core/Any.pm | |
index 002309b..fb439ad 100644 | |
--- a/src/core/Any.pm | |
+++ b/src/core/Any.pm | |
@@ -48,6 +48,9 @@ my class Any { | |
my $list = (self,).flat.eager; | |
my Mu $rsa := nqp::list_s(); | |
$list.gimme(4); # force reification of at least 4 elements | |
+ unless $list.infinite { | |
+ nqp::setelems($rsa, nqp::unbox_i($list.elems)); |
This file contains hidden or 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/Perl6/Metamodel/BOOTSTRAP.nqp b/src/Perl6/Metamodel/BOOTSTRAP.nqp | |
index 371e8fe..c4da30d 100644 | |
--- a/src/Perl6/Metamodel/BOOTSTRAP.nqp | |
+++ b/src/Perl6/Metamodel/BOOTSTRAP.nqp | |
@@ -83,23 +83,28 @@ my stub ForeignCode metaclass Perl6::Metamodel::ClassHOW { ... }; | |
BEGIN { | |
# Ensure Rakudo runtime support is initialized. | |
nqp::p6init(); | |
+ | |
+ # We'll want to get hold of static code refs for NQP subs. |
This file contains hidden or 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/Perl6/Grammar.nqp b/src/Perl6/Grammar.nqp | |
index e56f887..d996236 100644 | |
--- a/src/Perl6/Grammar.nqp | |
+++ b/src/Perl6/Grammar.nqp | |
@@ -3592,7 +3592,10 @@ grammar Perl6::Grammar is HLL::Grammar does STD { | |
# This also becomes the current MAIN. Also place it in %?LANG. | |
%*LANG<MAIN> := self.WHAT; | |
- $*W.install_lexical_symbol($*W.cur_lexpad(), '%?LANG', $*W.p6ize_recursive(%*LANG)); | |
+ unless $*W.cur_lexpad.symbol('%?LANG') { |