Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

[GGE::Perl6Regex] testing definedness

There's been a problem with testing values for definedness, when the undefined
value being returned is Nil, because Nil when stored in a variable mutates
into a defined value. Instead, we return Mu for the time being, a solution
which is impure but workable.

GGE is now fully ported to Rakudo master! \o/
  • Loading branch information...
commit 20751713def6d551064baf19efcb7c64211367c9 1 parent 712f2a0
@masak authored
Showing with 6 additions and 4 deletions.
  1. +6 −4 lib/GGE/Perl6Regex.pm
View
10 lib/GGE/Perl6Regex.pm
@@ -638,9 +638,7 @@ class GGE::Perl6Regex {
$exp.clear;
for @old-children -> $old-child {
my $new-child = perl6exp($old-child, %pad);
- # XXX: Should really be testing definedness, like PGE. Not sure
- # that it matters, though.
- if $new-child {
+ if defined $new-child {
$exp.push($new-child);
}
}
@@ -754,7 +752,11 @@ class GGE::Perl6Regex {
return $exp;
}
else {
- return Nil;
+ return Mu; # should be Nil, but we need to store the result
+ # from this call in a variable, and currently
+ # Rakudo promotes a Nil to something defined when
+ # it's stored into a variable, making the subsequent
+ # undefinedness test fail
}
}
Please sign in to comment.
Something went wrong with that request. Please try again.