Navigation Menu

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

smart-matching to Grammar should check type, not set $/ #302

Closed
p6rt opened this issue Sep 8, 2008 · 4 comments
Closed

smart-matching to Grammar should check type, not set $/ #302

p6rt opened this issue Sep 8, 2008 · 4 comments
Labels

Comments

@p6rt
Copy link

p6rt commented Sep 8, 2008

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

Searchable as RT58676$

@p6rt
Copy link
Author

p6rt commented Sep 8, 2008

From @cjfields

Currently this isn't specced (though moritz has posted a patch to p6l
for adding it to S05).

Per IRC and pmichaud/TimToady​:

http://irclog.perlgeek.de/parrot/2008-05-31#i_322490
http://irclog.perlgeek.de/parrot/2008-05-31#i_322527

The following is an example​:

grammar Foo {
  rule TOP {\d+};
};

my $x = '12345';

$x ~~ Foo; # Is $x a Foo? (No)
$x ~~ Foo.new; # does $x match Foo? (Yes)

In the latest version of Rakudo the first smart match sets $/ base on
Foo​::TOP, and the second smart match fails​:

...
too few arguments passed (1) - 3 params expected
current instr.​: 'parrot;PGE​::Match;new' pc 25 (compilers/pge/PGE/
Match.pir​:54)
called from Sub '_block11' pc 81 (EVAL_13​:34)
called from Sub 'parrot;PCT​::HLLCompiler;eval' pc 806 (src/PCT/
HLLCompiler.pir​:481)
called from Sub 'parrot;PCT​::HLLCompiler;evalfiles' pc 1078 (src/PCT/
HLLCompiler.pir​:610)
called from Sub 'parrot;PCT​::HLLCompiler;command_line' pc 1257 (src/
PCT/HLLCompiler.pir​:699)
called from Sub 'parrot;Perl6​::Compiler;main' pc 15960 (perl6.pir​:172)

chris

@p6rt
Copy link
Author

p6rt commented Feb 11, 2009

From @jnthn

On Mon Sep 08 08​:46​:20 2008, cjfields@​illinois.edu wrote​:

The following is an example​:

grammar Foo {
rule TOP {\d+};
};

my $x = '12345';

$x ~~ Foo; # Is $x a Foo? (No)

This now today will do a type-check. (Note that .new on grammars is
still a bit kinky, but .parse and .parsefile are the official ways to do
matching of a grammar now - .new will be dealt with by pm during other
PGE changes, I expect :-)).

So I think the main issue in this ticket is now resolved.

Thanks!

Jonathan

@p6rt
Copy link
Author

p6rt commented Feb 11, 2009

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

@p6rt
Copy link
Author

p6rt commented Feb 11, 2009

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

@p6rt p6rt closed this as completed Feb 11, 2009
@p6rt p6rt added the Bug 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