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

Inconsistency between &foo and sub a (&foo?) #3269

Closed
p6rt opened this issue Nov 9, 2013 · 4 comments
Closed

Inconsistency between &foo and sub a (&foo?) #3269

p6rt opened this issue Nov 9, 2013 · 4 comments

Comments

@p6rt
Copy link

p6rt commented Nov 9, 2013

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

Searchable as RT120501$

@p6rt
Copy link
Author

p6rt commented Nov 9, 2013

From @lizmat

[00​:09​:37] <lizmat> just found an inconsistency​:
[00​:09​:41] <lizmat> r​: my &foo; say &foo.WHAT
[00​:09​:44] <+camelia> rakudo-parrot 0cfe87, rakudo-jvm 882e33​: OUTPUT«(Any)␤»
[00​:09​:52] <lizmat> r​: sub a(​:&b) { say &b.WHAT }; a()
[00​:09​:55] <+camelia> rakudo-parrot 0cfe87, rakudo-jvm 882e33​: OUTPUT«(Callable)␤»
[00​:10​:20] <lizmat> a &foo variable is different from a &foo parameter?
[00​:10​:55] <lue> r​: my &foo; sub a(​:&b) { say &b.WHAT }; a(​:b(&foo));
[00​:10​:58] <+camelia> rakudo-parrot 0cfe87​: OUTPUT«Nominal type check failed for parameter '&b'; expected Callable but got Any instead␤ in sub a at /tmp/BEpd93gJkp​:1␤ in block at /tmp/BEpd93gJkp​:1␤ in any at /tmp/BEpd93gJkp​:1␤ in any at gen/parrot/stage2/NQPHLL.nqp​:1146␤ in any eval at …»
[00​:10​:59] <+camelia> ..rakudo-jvm 882e33​: OUTPUT«Nominal type check failed for parameter '&b'␤ in block at /tmp/uZuye0JnXG​:1␤ in any eval at gen/jvm/stage2/NQPHLL.nqp​:1086␤ in any evalfiles at gen/jvm/stage2/NQPHLL.nqp​:1292␤ in any command_eval at gen/jvm/stage2/NQPHLL.nqp​:1196␤ in any com…»
[00​:11​:30] <lizmat> lue​: indeed
[00​:11​:47] <lizmat> r​: sub a(&b?) { say &b.WHAT }; a() # doesn't have to be a named parameter
[00​:11​:50] <+camelia> rakudo-parrot 0cfe87, rakudo-jvm 882e33​: OUTPUT«(Callable)␤»
[00​:11​:54] <lue> r​: my $igil; my @​rray; my %ash; my &ode; say $igil.WHAT; say @​rray.WHAT; say %ash.WHAT; say &ode.WHAT;
[00​:11​:56] <+camelia> rakudo-parrot 0cfe87, rakudo-jvm 882e33​: OUTPUT«(Any)␤(Array)␤(Hash)␤(Any)␤»
[00​:12​:07] <lue> $ and & have something in common :)
[00​:12​:35] <lizmat> but why would that be diffferent for parameters ?
[00​:12​:40] <lue> $ -> Any makes sense to me, & -> Any less so. (It should be & -> Callable IMO, like @​ -> Array or % -> Hash)
[00​:13​:38] <lue> r​: sub a($ig?, @​rr?, %as?, &od?) { say $ig.WHAT; say @​rr.WHAT; say %as.WHAT; say &od.WHAT }; a()
[00​:13​:41] <+camelia> rakudo-parrot 0cfe87, rakudo-jvm 882e33​: OUTPUT«(Any)␤(Array)␤(Hash)␤(Callable)␤»
[00​:13​:55] <lue> & is the only inconsistent one it seems.
[00​:14​:05] <lizmat> yup
[00​:14​:11] lizmat submits rakudobug

@p6rt
Copy link
Author

p6rt commented Nov 14, 2013

From @lizmat

This most definitely has been fixed with tests

@p6rt
Copy link
Author

p6rt commented Nov 14, 2013

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

@p6rt p6rt closed this as completed Nov 14, 2013
@p6rt
Copy link
Author

p6rt commented Nov 14, 2013

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

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