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

Less than awesome error message on passing :$!foo-type pairs to subs in Rakudo #1160

Closed
p6rt opened this issue Jul 24, 2009 · 5 comments
Closed
Labels

Comments

@p6rt
Copy link

p6rt commented Jul 24, 2009

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

Searchable as RT67846$

@p6rt
Copy link
Author

p6rt commented Jul 24, 2009

From @masak

<masak> rakudo​: sub foo(​:$bar) { say $bar }; class A { has $.bar;
method baz() { foo(​:$.bar) } }; A.new(​:bar<OH HAI>).baz
<p6eval> rakudo b19862​: OUTPUT«Symbol '$1bar' not predeclared in baz [...]
<masak> :)
* masak submits rakudobug
<masak> now, are my expectations right in this case? could the above
code print "OH HAI"?
<Matt-W> masak​: I don't know if your expectations are correct
<Matt-W> Is :$.bar supposed to be like :bar($.bar)
<masak> aye.
<masak> that was my expectation.
<moritz_> I don't think so
<Matt-W> Because I wouldn't expect so without reading it somewhere
<moritz_> because $.bar is not parsed as a variable, but as a method call
<masak> moritz_​: does that matter?
<moritz_> it does matter, Perl 6 is all about syntax
<masak> and what about :$!bar, then?
<Matt-W> I would expect the same behaviour as $.bar
<Matt-W> whatever that happens to be...
<masak> rakudo​: sub foo(​:$bar) { say $bar }; class A { has $!bar;
method baz() { foo(​:$!bar) } }; A.new(​:bar<OH HAI>).baz
<p6eval> rakudo b19862​: OUTPUT«Symbol '$1bar' not predeclared in baz [...]
<masak> I still think Rakudo does the Wrong thing here.
<moritz_> $1bar?
<masak> there's no $1bar variable.
<masak> right.
<moritz_> that's a less-than-awesome error message
<Matt-W> At the very least
<moritz_> (hint, hint)
<masak> yes, it alone merits a bug report.
<masak> moritz_​: I'm writing it now. you're in it! :)
<Matt-W> It's either a Missing Feature or a less-than-awesome error message
<Matt-W> the question is which
<masak> Matt-W​: exactly.
<moritz_> well, the table in S06 for named arguments doesn't list it, I think
<masak> I see no reason why it shouldn't work.
<masak> same with $^placeholder variables, I'd say.
<Matt-W> I see no reason why it should
<moritz_> convenience would a good reason, no?
<Matt-W> Mmm
<masak> I think so.
<Matt-W> I can seen an argument for it
<masak> consistency, too.
<moritz_> Perl 6 is all about convenience; otherwise we'd still be
writing assembler code ;-)
<masak> it's not like the syntax is being used for something else.

@p6rt
Copy link
Author

p6rt commented Jul 28, 2010

From @coke

On Fri Jul 24 02​:41​:50 2009, masak wrote​:

<masak> rakudo​: sub foo(​:$bar) { say $bar }; class A { has $.bar;
method baz() { foo(​:$.bar) } }; A.new(​:bar<OH HAI>).baz
<p6eval> rakudo b19862​: OUTPUT«Symbol '$1bar' not predeclared in baz
[...]
<masak> :)
* masak submits rakudobug
<masak> now, are my expectations right in this case? could the above
code print "OH HAI"?
<Matt-W> masak​: I don't know if your expectations are correct
<Matt-W> Is :$.bar supposed to be like :bar($.bar)
<masak> aye.
<masak> that was my expectation.
<moritz_> I don't think so
<Matt-W> Because I wouldn't expect so without reading it somewhere
<moritz_> because $.bar is not parsed as a variable, but as a method
call
<masak> moritz_​: does that matter?
<moritz_> it does matter, Perl 6 is all about syntax
<masak> and what about :$!bar, then?
<Matt-W> I would expect the same behaviour as $.bar
<Matt-W> whatever that happens to be...
<masak> rakudo​: sub foo(​:$bar) { say $bar }; class A { has $!bar;
method baz() { foo(​:$!bar) } }; A.new(​:bar<OH HAI>).baz
<p6eval> rakudo b19862​: OUTPUT«Symbol '$1bar' not predeclared in baz
[...]
<masak> I still think Rakudo does the Wrong thing here.
<moritz_> $1bar?
<masak> there's no $1bar variable.
<masak> right.
<moritz_> that's a less-than-awesome error message
<Matt-W> At the very least
<moritz_> (hint, hint)
<masak> yes, it alone merits a bug report.
<masak> moritz_​: I'm writing it now. you're in it! :)
<Matt-W> It's either a Missing Feature or a less-than-awesome error
message
<Matt-W> the question is which
<masak> Matt-W​: exactly.
<moritz_> well, the table in S06 for named arguments doesn't list it,
I think
<masak> I see no reason why it shouldn't work.
<masak> same with $^placeholder variables, I'd say.
<Matt-W> I see no reason why it should
<moritz_> convenience would a good reason, no?
<Matt-W> Mmm
<masak> I think so.
<Matt-W> I can seen an argument for it
<masak> consistency, too.
<moritz_> Perl 6 is all about convenience; otherwise we'd still be
writing assembler code ;-)
<masak> it's not like the syntax is being used for something else.

<Coke> rakudo​: sub foo(​:$bar) { say $bar }; class A { has $.bar; method
  baz() { foo(​:$.bar) } }; A.new(​:bar<OH HAI>).baz
<p6eval> rakudo 2808a5​: OUTPUT«OH HAI␤»

Assigning to moritz++ for spectesting.

--
Will "Coke" Coleda

@p6rt
Copy link
Author

p6rt commented Jul 28, 2010

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

@p6rt
Copy link
Author

p6rt commented Jul 28, 2010

From @moritz

:$!foo style colonpairs are tested in
t/spec/S06-signature/named-parameters.t already.

@p6rt
Copy link
Author

p6rt commented Jul 28, 2010

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

@p6rt p6rt closed this as completed Jul 28, 2010
@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