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

Omitted typed named params cause errors in Rakudo #680

Closed
p6rt opened this issue Feb 5, 2009 · 5 comments
Closed

Omitted typed named params cause errors in Rakudo #680

p6rt opened this issue Feb 5, 2009 · 5 comments

Comments

@p6rt
Copy link

p6rt commented Feb 5, 2009

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

Searchable as RT63048$

@p6rt
Copy link
Author

p6rt commented Feb 5, 2009

From @masak

<mberends> </lurk> moritz_​: is it a known gotcha that named parameters
cause errors if they are typed and then omitted? S06 is silent on
typing.
<mberends> rakudo​: class A { method m(​:$p) { say "param $p"; }; };
A.new.m("HAI");
<p6eval> rakudo c10807​: OUTPUT«param HAI␤»
<mberends> rakudo​: class A { method m(Str :$p) { say "param $p"; }; };
A.new.m("HAI");
<p6eval> rakudo c10807​: OUTPUT«param HAI␤»
<mberends> rakudo​: class A { method m(Str :$p) { say "param $p"; }; };
A.new.m();
<p6eval> rakudo c10807​: OUTPUT«Parameter type check failed for $p in
call to m [...]
<mberends> rakudo​: class A { method m(​:$p) { say "param $p"; }; }; A.new.m();
<p6eval> rakudo c10807​: OUTPUT«Use of uninitialized value␤param ␤»
<mberends> <lurk>
  [12​:31]
<moritz_> mberends​: not known I think... care to open a ticket?
* masak submits

@p6rt
Copy link
Author

p6rt commented Feb 7, 2009

From @mberends

Improving the signal-to-noise ratio of the above, using perl6 -e'...'​:

class A {method m(Str :$p){my $p2=$p // "";say "m$p2"}}; A.new.m("HAI")
class A {method m(Str :$p){my $p2=$p // "";say "m$p2"}}; A.new.m()

The first line works.
The second dies saying 'Parameter type check failed for $p in call to m'

Remove the Str type and they both work​:

class A {method m(​:$p){my $p2=$p // "";say "m$p2"}}; A.new.m("HAI")
class A {method m(​:$p){my $p2=$p // "";say "m$p2"}}; A.new.m()

@p6rt
Copy link
Author

p6rt commented Feb 11, 2009

From @jnthn

On Fri Feb 06 23​:12​:31 2009, mberends wrote​:

Improving the signal-to-noise ratio of the above, using perl6 -e'...'​:

class A {method m(Str :$p){my $p2=$p // "";say "m$p2"}}; A.new.m("HAI")
class A {method m(Str :$p){my $p2=$p // "";say "m$p2"}}; A.new.m()

The first line works.
The second dies saying 'Parameter type check failed for $p in call to m'

Now as of git 50a61ae they both work, as they should.

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
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