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

Match.print is Any.print but Cursor.print refers to <print> subrule. #954

Closed
p6rt opened this issue Apr 28, 2009 · 6 comments
Closed

Match.print is Any.print but Cursor.print refers to <print> subrule. #954

p6rt opened this issue Apr 28, 2009 · 6 comments
Labels

Comments

@p6rt
Copy link

p6rt commented Apr 28, 2009

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

Searchable as RT65208$

@p6rt
Copy link
Author

p6rt commented Apr 28, 2009

From @masak

<masak> rakudo​: grammar A { regex TOP { foo } }; A.parse("foo").say;
say "bar"; A.parse("foo").print; say "bar"
<p6eval> rakudo ae5e29​: OUTPUT«foo␤bar␤bar␤»
* masak submits rakudobug

Expected output​: «foo␤bar␤foobar␤».

@p6rt
Copy link
Author

p6rt commented May 14, 2009

From @pmichaud

On Tue Apr 28 07​:44​:46 2009, masak wrote​:

<masak> rakudo​: grammar A { regex TOP { foo } }; A.parse("foo").say;
say "bar"; A.parse("foo").print; say "bar"
<p6eval> rakudo ae5e29​: OUTPUT«foo␤bar␤bar␤»
* masak submits rakudobug

Expected output​: «foo␤bar␤foobar␤».

The problem here is that .print is conflicting with the pre-defined
<print> subrule for regexes (matching a printable character). I'm not
quite sure how to resolve this.

There are quite a few workarounds, however​:

  print(A.parse('foo'));
  A.parse('foo').Str.print;
  (~A.parse('foo')).print;

I'm not sure what the correct behavior should be here, so I'm converting
this ticket into a request to confirm/clarify the spec.

Thanks!

Pm

@p6rt
Copy link
Author

p6rt commented May 14, 2009

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

@p6rt
Copy link
Author

p6rt commented May 15, 2009

From @pmichaud

On Thu, May 14, 2009 at 11​:34​:21AM -0700, Patrick R. Michaud via RT wrote​:

I'm not sure what the correct behavior should be here, so I'm converting
this ticket into a request to confirm/clarify the spec.

Followup...

Larry has since clarified that .print on a Cursor object
(used while performing the match) refers to the <print> rule,
while .print on a Match object (the returned value of a match)
inherits from Any.print .

It may take a short while for me to reconfigure either Rakudo or
PGE for this behavior, but we know how it's likely to end up.

Pm

@p6rt
Copy link
Author

p6rt commented Nov 2, 2011

From @moritz

Fixed in rakudo, and tested in say.t

@p6rt
Copy link
Author

p6rt commented Nov 2, 2011

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

@p6rt p6rt closed this as completed Nov 2, 2011
@p6rt p6rt added the Todo label Jan 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant