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

Cannot always match signature when default value is a sub #2059

Closed
p6rt opened this issue Aug 11, 2010 · 5 comments
Closed

Cannot always match signature when default value is a sub #2059

p6rt opened this issue Aug 11, 2010 · 5 comments
Labels

Comments

@p6rt
Copy link

p6rt commented Aug 11, 2010

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

Searchable as RT77164$

@p6rt
Copy link
Author

p6rt commented Aug 11, 2010

From patrick.abisalloum@gmail.com

<patrickas> rakudo​: sub foo ( $f = rand ) { say $f; }; say
Capture.new() ~~ &foo.signature; #does not match
<p6eval> rakudo c1e19a​: OUTPUT«0␤»

<patrickas> rakudo​: sub foo ( $f = 0.461541885367723 ) { say $f; };
say Capture.new() ~~ &foo.signature; #matches
<p6eval> rakudo c1e19a​: OUTPUT«1␤»

<patrickas> rakudo​: sub foo ( $f = substr('string',0) ) { say $f; };
say Capture.new() ~~ &foo.signature; #matches
<p6eval> rakudo c1e19a​: OUTPUT«1␤»

@p6rt
Copy link
Author

p6rt commented Jan 11, 2012

From @coke

On Wed Aug 11 08​:58​:45 2010, patrickas wrote​:

<patrickas> rakudo​: sub foo ( $f = rand ) { say $f; }; say
Capture.new() ~~ &foo.signature; #does not match
<p6eval> rakudo c1e19a​: OUTPUT«0␤»

<patrickas> rakudo​: sub foo ( $f = 0.461541885367723 ) { say $f; };
say Capture.new() ~~ &foo.signature; #matches
<p6eval> rakudo c1e19a​: OUTPUT«1␤»

<patrickas> rakudo​: sub foo ( $f = substr('string',0) ) { say $f; };
say Capture.new() ~~ &foo.signature; #matches
<p6eval> rakudo c1e19a​: OUTPUT«1␤»

These now all fail to smartmatch, which I don't think is the requested
behavior; is it the spec'd behavior?

--
Will "Coke" Coleda

@p6rt
Copy link
Author

p6rt commented Jan 11, 2012

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

@p6rt
Copy link
Author

p6rt commented Jan 3, 2013

From @moritz

This has been fixed by jnthn++; smart-matching a capture against a
signature is now properly implemented.

I've added a test to S03-smartmatch/capture-signature.t; more tests are
welcome too.

@p6rt
Copy link
Author

p6rt commented Jan 3, 2013

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

@p6rt p6rt closed this as completed Jan 3, 2013
@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