Skip to content

Instantly share code, notes, and snippets.

@lizmat
Created April 1, 2017 12:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lizmat/5f5bdb529a46d8c037d06e6093249251 to your computer and use it in GitHub Desktop.
Save lizmat/5f5bdb529a46d8c037d06e6093249251 to your computer and use it in GitHub Desktop.
Making set() a sentinel
diff --git a/src/Perl6/Actions.nqp b/src/Perl6/Actions.nqp
index b2e60a1..d4e2b92 100644
--- a/src/Perl6/Actions.nqp
+++ b/src/Perl6/Actions.nqp
@@ -5544,8 +5544,12 @@ class Perl6::Actions is HLL::Actions does STDActions {
make QAST::Op.new( :op('call'), :name('&term:<time>'), :node($/) );
}
+ my $empty_set;
method term:sym<empty_set>($/) {
- make QAST::Op.new( :op('call'), :name('&set'), :node($/) );
+ unless $empty_set {
+ $empty_set := nqp::create($*W.find_symbol(['Set']));
+ }
+ make QAST::WVal.new( :value($empty_set) );
}
method term:sym<rand>($/) {
=================
$ 6 'use nqp; dd nqp::objectid(∅); dd nqp::objectid(∅)'
===SORRY!===
Object of type Set in QAST::WVal, but not in SC
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment