Skip to content

Instantly share code, notes, and snippets.

@tadzik
Created May 1, 2012 11:27
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 tadzik/2567462 to your computer and use it in GitHub Desktop.
Save tadzik/2567462 to your computer and use it in GitHub Desktop.
diff --git a/src/core/terms.pm b/src/core/terms.pm
index 5eb27c0..96d7cc0 100644
--- a/src/core/terms.pm
+++ b/src/core/terms.pm
@@ -19,7 +19,16 @@ sub term:<time>() { nqp::p6box_i(pir::time__I()) }
method at_key($k) {
Proxy.new(
FETCH => {
- nqp::p6box_s(nqp::atkey($env, nqp::unbox_s($k)))
+ my Mu $e := nqp::existskey($env, nqp::unbox_s($k));
+ say "alive";
+ if $e { say "alive2" }
+ say "alive";
+ if nqp::p6bool($e) {
+ return nqp::p6box_s(nqp::atkey($env, nqp::unbox_s($k)))
+ }
+ else {
+ return Any
+ }
},
STORE => -> $, $v {
nqp::bindkey($env, nqp::unbox_s($k), nqp::unbox_s($v))
┌─[tadzik@yavin4]─[~/src/nom] (nom)*
└─[%]─> ./perl6 -e 'say 1'
alive
alive3
zsh: segmentation fault ./perl6 -e 'say 1'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment