Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rakudo can't iterate on a Match object #739

Closed
p6rt opened this issue Mar 2, 2009 · 7 comments
Closed

Rakudo can't iterate on a Match object #739

p6rt opened this issue Mar 2, 2009 · 7 comments

Comments

@p6rt
Copy link

p6rt commented Mar 2, 2009

Migrated from rt.perl.org#63606 (status was 'resolved')

Searchable as RT63606$

@p6rt
Copy link
Author

p6rt commented Mar 2, 2009

From @masak

<moritz_> rakudo​: rule w { . }; 'a' ~~ m/<w>/; for %($/<w>).kv {}
<p6eval> rakudo 50279c​: RESULT«Method 'HOW' not found for invocant of
class 'Iterator' [...]
* moritz_ found a bug
<masak> moritz_​: shall I send it in?
<moritz_> masak​: please do
* masak does

@p6rt
Copy link
Author

p6rt commented Mar 3, 2009

From @pmichaud

On Mon, Mar 02, 2009 at 08​:33​:16AM -0800, Carl Mäsak wrote​:

<moritz_> rakudo​: rule w { . }; 'a' ~~ m/<w>/; for %($/<w>).kv {}
<p6eval> rakudo 50279c​: RESULT«Method 'HOW' not found for invocant of
class 'Iterator' [...]

While I agree that the error message is likely incorrect -- I'm not
sure what the intent of the original code is here. Wouldn't %($/<w>)
be empty, since the rule doesn't have any named captures?

Pm

@p6rt
Copy link
Author

p6rt commented Mar 3, 2009

The RT System itself - Status changed from 'new' to 'open'

@p6rt
Copy link
Author

p6rt commented Mar 3, 2009

From @moritz

On Mon Mar 02 16​:26​:59 2009, pmichaud wrote​:

On Mon, Mar 02, 2009 at 08​:33​:16AM -0800, Carl Mäsak wrote​:

<moritz_> rakudo​: rule w { . }; 'a' ~~ m/<w>/; for %($/<w>).kv {}
<p6eval> rakudo 50279c​: RESULT«Method 'HOW' not found for invocant of
class 'Iterator' [...]

While I agree that the error message is likely incorrect -- I'm not
sure what the intent of the original code is here. Wouldn't %($/<w>)
be empty, since the rule doesn't have any named captures?

It does, and it actually works. The example is bogus; the example above
didn't produce any output, and thus p6eval wraps it with a (do { ...
}).perl.print block and executes it a second time, which is where the
error message comes from.

I have no idea what an empty for-loop is supposed to return (a Nil?
empty List? or can't it used as an expression at all?), so I can't
decide if that's really a bug.

Cheers,
Moritz

@p6rt
Copy link
Author

p6rt commented Jul 7, 2010

From @pmichaud

Rakudo now does the right thing with iterating the match object​:

  > 'a' ~~ /<alpha>/; for %($<alpha>) { }; say "done";
  done
  >

Assigning to moritz for spectesting.

Pm

@p6rt
Copy link
Author

p6rt commented Jul 15, 2010

From @moritz

%($something_matchy) now returns a proper Perl 6 hash (which is tested),
and we have enough tests for %hash.kv. So I'm closing this ticket
without explicit test coverage, but with confidence that there's enough
implicit coverage.

@p6rt
Copy link
Author

p6rt commented Jul 15, 2010

@moritz - Status changed from 'open' to 'resolved'

@p6rt p6rt closed this as completed Jul 15, 2010
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant