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

Weird error for code parameters with subsignatures in Rakudo #3575

Closed
p6rt opened this issue Nov 3, 2014 · 8 comments
Closed

Weird error for code parameters with subsignatures in Rakudo #3575

p6rt opened this issue Nov 3, 2014 · 8 comments

Comments

@p6rt
Copy link

p6rt commented Nov 3, 2014

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

Searchable as RT123116$

@p6rt
Copy link
Author

p6rt commented Nov 3, 2014

From @masak

<masak> m​: class Dog {}; sub foo(&block (Dog --> Bool)) { say "OH HAI"
}; foo(sub (Dog $x) { $x })
<camelia> rakudo-moar 315ec6​: OUTPUT«Too few positionals passed;
expected 1 argument but got 0 in sub-signature of parameter &block
[...]
<masak> what am I doing wrong here?
<masak> m​: class Dog {}; sub foo(&block​:(Dog --> Bool)) { say "OH HAI"
}; foo(sub (Dog $x) { $x })
<camelia> rakudo-moar 315ec6​: OUTPUT«===SORRY!===␤Cannot invoke this
object (REPR​: P6opaque, cs = 0)␤»
<masak> o.O
<FROGGS> m​: sub foo ( &cb (int) ) { }; sub bar (int) { }; foo(&bar) #
masak​: no idea why that fails
<camelia> rakudo-moar 315ec6​: OUTPUT«Too few positionals passed;
expected 1 argument but got 0 in sub-signature of parameter &cb [...]
<masak> FROGGS​: the error message doesn't make any sense.
<FROGGS> masak​: and that feature works in nativecall
<FROGGS> it is in its test suite for example
<masak> even curiouser.
<FROGGS> and it also fails under 2014.09
<FROGGS> (using star-m)

I am not 100% sure the `&block (Dog --> Bool)` form should work, or is
by spec. The `&block​:(Dog --> Bool)` form comes from S06​:1675.

@p6rt
Copy link
Author

p6rt commented Dec 7, 2014

From @masak

masak (>)​:

I am not 100% sure the `&block (Dog --> Bool)` form should work,
or is by spec. The `&block​:(Dog --> Bool)` form comes from S06​:1675.

<TimToady> at one point we required a : because of the ambiguity with sublists of parameters, but we already have a whitespace dep with @​foo[3,3] vs @​foo [$x,$y,$z], so having one for () is probably not terrible
* masak adds TimToady's comment to the ticket

@p6rt
Copy link
Author

p6rt commented Dec 9, 2014

From @hoelzro

On Sun Dec 07 07​:41​:52 2014, masak wrote​:

masak (>)​:

I am not 100% sure the `&block (Dog --> Bool)` form should work,
or is by spec. The `&block​:(Dog --> Bool)` form comes from S06​:1675.

<TimToady> at one point we required a : because of the ambiguity with
sublists of parameters, but we already have a whitespace dep with
@​foo[3,3] vs @​foo [$x,$y,$z], so having one for () is probably not
terrible
* masak adds TimToady's comment to the ticket

This bug has largely been resolved; closure parameters now parse correctly and work, except when used to decide between different multi candidates.

@p6rt
Copy link
Author

p6rt commented Dec 9, 2014

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

@p6rt
Copy link
Author

p6rt commented Dec 2, 2017

From @AlexDaniel

Yeah. It was resolved here I think​: (2014-12-08) rakudo/rakudo@fbc87d2

「testneeded」

On 2014-12-09 04​:54​:08, rob@​hoelz.ro wrote​:

On Sun Dec 07 07​:41​:52 2014, masak wrote​:

masak (>)​:

I am not 100% sure the `&block (Dog --> Bool)` form should work,
or is by spec. The `&block​:(Dog --> Bool)` form comes from
S06​:1675.

<TimToady> at one point we required a : because of the ambiguity with
sublists of parameters, but we already have a whitespace dep with
@​foo[3,3] vs @​foo [$x,$y,$z], so having one for () is probably not
terrible
* masak adds TimToady's comment to the ticket

This bug has largely been resolved; closure parameters now parse
correctly and work, except when used to decide between different multi
candidates.

@p6rt
Copy link
Author

p6rt commented Dec 12, 2017

From @zoffixznet

On Sat, 02 Dec 2017 05​:19​:45 -0800, alex.jakimenko@​gmail.com wrote​:

Yeah. It was resolved here I think​: (2014-12-08)
rakudo/rakudo@fbc87d2

「testneeded」

On 2014-12-09 04​:54​:08, rob@​hoelz.ro wrote​:

On Sun Dec 07 07​:41​:52 2014, masak wrote​:

masak (>)​:

I am not 100% sure the `&block (Dog --> Bool)` form should work,
or is by spec. The `&block​:(Dog --> Bool)` form comes from
S06​:1675.

<TimToady> at one point we required a : because of the ambiguity
with
sublists of parameters, but we already have a whitespace dep with
@​foo[3,3] vs @​foo [$x,$y,$z], so having one for () is probably not
terrible
* masak adds TimToady's comment to the ticket

This bug has largely been resolved; closure parameters now parse
correctly and work, except when used to decide between different
multi
candidates.

The form with space wasn't implemented.

It is now​: rakudo/rakudo@c0f99a393b
Tests for both forms​: Raku/roast@a31e4655e8

@p6rt
Copy link
Author

p6rt commented Dec 12, 2017

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

@p6rt p6rt closed this as completed Dec 12, 2017
@p6rt
Copy link
Author

p6rt commented Dec 12, 2017

From @zoffixznet

On Mon, 11 Dec 2017 20​:30​:18 -0800, cpan@​zoffix.com wrote​:

The form with space wasn't implemented.

It is now​: rakudo/rakudo@c0f99a393b

Never mind. Decided to revert that form ( rakudo/rakudo@2f955d55e3 )

The `​:()` form is actually a Signature literal appended to the parameter, which is
nice and slick and makes lots of sense.

Adding slightly different syntax to do the same didn't feel right (since with Positionals, it means calling .Capture, while here it don't)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant