Skip to content

Commit

Permalink
Revert ""Do. Or do not. There is no try.""
Browse files Browse the repository at this point in the history
This reverts commit 738908b.

Such behaviour has too much unwanted impact in grammar actions
where $/ is the common name for the parameter. Having to change
$/ to something else the second you introduce a .subst call
(or other methods that set $/) is a bit too much.

https://irclog.perlgeek.de/perl6-dev/2017-11-05#i_15404670
  • Loading branch information
zoffixznet committed Nov 5, 2017
1 parent 824a5dc commit 1c38715
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/core/Str.pm
Expand Up @@ -1096,7 +1096,7 @@ my class Str does Stringy { # declared in BOOTSTRAP
my $SET_DOLLAR_SLASH = nqp::istype($matcher, Regex);
my $word_by_word = so $samespace || %options<s> || %options<sigspace>;

$caller_dollar_slash = $/ if $SET_DOLLAR_SLASH;
try $caller_dollar_slash = $/ if $SET_DOLLAR_SLASH;
my @matches = %options
?? self.match($matcher, |%options)
!! self.match($matcher); # 30% faster
Expand Down Expand Up @@ -1169,7 +1169,7 @@ my class Str does Stringy { # declared in BOOTSTRAP
my $word_by_word = so $samespace || %options<s> || %options<sigspace>;

# nothing to do
caller_dollar_slash = $/ if $SET_DOLLAR_SLASH;
try caller_dollar_slash = $/ if $SET_DOLLAR_SLASH;
my @matches = %options
?? self.match($matcher, :$g, |%options)
!! self.match($matcher, :$g); # 30% faster
Expand All @@ -1196,7 +1196,7 @@ my class Str does Stringy { # declared in BOOTSTRAP
my int $prev;
my str $str = nqp::unbox_s(self);
my Mu $result := nqp::list_s();
cds = $/ if SDS;
try cds = $/ if SDS;

# need to do something special
if SDS || space || case || mark || callable {
Expand All @@ -1205,7 +1205,7 @@ my class Str does Stringy { # declared in BOOTSTRAP
my \case-and-mark := case && mark;

for flat matches -> $m {
cds = $m if SDS;
try cds = $m if SDS;
nqp::push_s(
$result,nqp::substr($str,$prev,nqp::unbox_i($m.from) - $prev)
);
Expand Down

0 comments on commit 1c38715

Please sign in to comment.