Re: Is this a strange regex bug in my code?

2014-12-30 Thread Gabor Szabo
if not $tmpl ~~ m/\.txt$/ { ... } fails the same way. if not $tmpl ~~ /\.txt$/ { ... } works like a charm. Gabor On Tue, Dec 30, 2014 at 9:48 AM, Patrick R. Michaud wrote: > I suspect it may be some weirdness with the way that $_ is being handled > in smartmatching, then. > > I think

Re: Is this a strange regex bug in my code?

2014-12-29 Thread Patrick R. Michaud
I suspect it may be some weirdness with the way that $_ is being handled in smartmatching, then. I think there's a slight difference between $tmpl ~~ /regex/ and $tmpl ~~ m/regex/ The first one does the equivalent of /regex/.ACCEPTS($tmpl), which ends up matching $tmpl directly again

Re: Is this a strange regex bug in my code?

2014-12-29 Thread Gabor Szabo
No. If I remove the leading m from the regex, then the bug is gone. Gabor On Tue, Dec 30, 2014 at 9:19 AM, Patrick R. Michaud wrote: > Out of curiosity, is the bug still present if you use /\.txt$/ instead of > m/\.txt$/ ? > > At the moment it looks like a Rakudo bug to me, but I haven't been ab

Re: Is this a strange regex bug in my code?

2014-12-29 Thread Patrick R. Michaud
Out of curiosity, is the bug still present if you use /\.txt$/ instead of m/\.txt$/ ? At the moment it looks like a Rakudo bug to me, but I haven't been able to golf it further to be certain. Pm On Tue, Dec 30, 2014 at 09:11:52AM +0200, Gabor Szabo wrote: > Just to follow-up: > The problem a

Re: Is this a strange regex bug in my code?

2014-12-29 Thread Gabor Szabo
Just to follow-up: The problem appears in https://github.com/szabgab/Perl6-Maven/commit/4346c96d63e97def55e789bbeebdbdaebe8b0b33 After that I have replaced the regex match with if substr($tmpl, *-4) ne '.txt' { that works correctly, but I'd still like to understand if the bug was in my code, or

Is this a strange regex bug in my code?

2014-12-29 Thread Gabor Szabo
I am puzzled by this. I have code like this: my @files = dir("$.source_dir").map({ $_.basename }); for @files -> $tmpl { if $tmpl !~~ m/\.txt$/ { debug("Skipping '$tmpl' it does not end with .txt"); next; } debug("Source file $tmpl"); } and