Skip to content

Instantly share code, notes, and snippets.

@ShimmerFairy
Created July 6, 2010 18:31
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 ShimmerFairy/465750 to your computer and use it in GitHub Desktop.
Save ShimmerFairy/465750 to your computer and use it in GitHub Desktop.
From a5d760f9748bc88398e1806b4f69fd3f00d4c90f Mon Sep 17 00:00:00 2001
From: Matthew (lue) <rnddim@gmail.com>
Date: Tue, 6 Jul 2010 11:09:34 -0700
Subject: [PATCH] Begin implementation of ::= binding.
---
src/Perl6/Grammar.pm | 1 -
src/core/operators.pm | 8 ++++++++
2 files changed, 8 insertions(+), 1 deletions(-)
diff --git a/src/Perl6/Grammar.pm b/src/Perl6/Grammar.pm
index 0571e59..7f25c80 100644
--- a/src/Perl6/Grammar.pm
+++ b/src/Perl6/Grammar.pm
@@ -1778,7 +1778,6 @@ method bindish_check($/) {
token infix:sym<::=> {
<sym> <O('%item_assignment')>
- <.panic: "::= binding not yet implemented">
}
token infix:sym<.=> { <sym> <O('%item_assignment, :nextterm<dottyopish>')> }
diff --git a/src/core/operators.pm b/src/core/operators.pm
index 7d68c9d..40300e0 100644
--- a/src/core/operators.pm
+++ b/src/core/operators.pm
@@ -308,6 +308,14 @@ our multi infix:<:=>(Signature $s, Mu \$val) {
$s!BIND(Capture.new($val));
}
+our multi infix:<::=>(Mu \$target, Mu \$source) {
+ #since it's only := with setting readonly, let's avoid recoding.
+ $target := $source;
+ #XX pay attention to this little guy, we don't quite understand or are
+ #able to implement the full details of ::=
+ pir::delprop__0Ps($target, 'rw');
+}
+
# XXX Wants to be a macro when we have them.
our sub WHAT(\$x) {
$x.WHAT
--
1.6.0.4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment