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

The compiler shouldn't yell at a call to a subroutine that has been wrapped by a trait in Rakudo #3727

Open
p6rt opened this issue Mar 10, 2015 · 3 comments
Labels
Bug

Comments

@p6rt
Copy link

@p6rt p6rt commented Mar 10, 2015

Migrated from rt.perl.org#124036 (status was 'open')

Searchable as RT124036$

@p6rt

This comment has been minimized.

Copy link
Author

@p6rt p6rt commented Mar 10, 2015

From @masak

<Ven> m​: sub trait_mod​:<is>(&c, :$curried!) { my $arity = &c.arity;
&c.wrap(-> |args { args.list.elems == $arity ?? callsame() !!
&c.assuming(|args); }); }; sub foo($a, $b) is curried { say $a + $b;
}; foo(3, 4); my $c = foo(5); $c(6);
<camelia> rakudo-moar f8002f​: OUTPUT«===SORRY!=== Error while
compiling /tmp/CqAnyz9U98␤Calling 'foo' will never work with argument
types (int)␤ Expected​: :(Any $a, Any $b)␤at
/tmp/CqAnyz9U98​:1␤------> ed { say $a + $b; }; foo(3, 4); my $c =
⏏foo(5); $c(6);␤»
<Ven> if an "is" wraps a sub, then it probably shouldnt get checked :)
* masak can't decide who is right, Ven or Rakudo
<masak> probably Ven.
* masak submits rakudobug
<Ven> :D
<masak> Ven​: it is seldom this close. congratulations.
<Ven> thanks, I guess
* psch agrees
<psch> m​: sub trait_mod​:<is>(&c, :$curried!) { my $arity = &c.arity;
&c.wrap(-> |args { args.list.elems == $arity ?? callsame() !!
&c.assuming(|args); }); }; my &foo = sub ($a, $b) is curried { say $a
+ $b; }; foo(3)(4) # seeing as this works
<camelia> rakudo-moar f8002f​: OUTPUT«7␤»
<PerlJam> psch++
<psch> but then we can't rebind a normal sub declaration either
<psch> which i think was justified with "it would break optimisation"
<psch> having the distinction makes "sub foo { }" somewhat magical
over "my &foo = sub { }", which is surprising, and with the bit of
jnthn++'s FOSDEM talk that i watched yesterday even seems wrong,
because "sub foo { }" is supposed to be just a lexical declaration
(unless there was more that i missed)

@p6rt

This comment has been minimized.

Copy link
Author

@p6rt p6rt commented Dec 3, 2017

From @AlexDaniel

Still same error message (2017.11,HEAD(e5b660e))

On 2015-03-10 09​:12​:23, masak wrote​:

<Ven> m​: sub trait_mod​:<is>(&c, :$curried!) { my $arity = &c.arity;
&c.wrap(-> |args { args.list.elems == $arity ?? callsame() !!
&c.assuming(|args); }); }; sub foo($a, $b) is curried { say $a + $b;
}; foo(3, 4); my $c = foo(5); $c(6);
<camelia> rakudo-moar f8002f​: OUTPUT«===SORRY!=== Error while
compiling /tmp/CqAnyz9U98␤Calling 'foo' will never work with argument
types (int)␤ Expected​: :(Any $a, Any $b)␤at
/tmp/CqAnyz9U98​:1␤------> ed { say $a + $b; }; foo(3, 4); my $c =
⏏foo(5); $c(6);␤»
<Ven> if an "is" wraps a sub, then it probably shouldnt get checked :)
* masak can't decide who is right, Ven or Rakudo
<masak> probably Ven.
* masak submits rakudobug
<Ven> :D
<masak> Ven​: it is seldom this close. congratulations.
<Ven> thanks, I guess
* psch agrees
<psch> m​: sub trait_mod​:<is>(&c, :$curried!) { my $arity = &c.arity;
&c.wrap(-> |args { args.list.elems == $arity ?? callsame() !!
&c.assuming(|args); }); }; my &foo = sub ($a, $b) is curried { say $a
+ $b; }; foo(3)(4) # seeing as this works
<camelia> rakudo-moar f8002f​: OUTPUT«7␤»
<PerlJam> psch++
<psch> but then we can't rebind a normal sub declaration either
<psch> which i think was justified with "it would break optimisation"
<psch> having the distinction makes "sub foo { }" somewhat magical
over "my &foo = sub { }", which is surprising, and with the bit of
jnthn++'s FOSDEM talk that i watched yesterday even seems wrong,
because "sub foo { }" is supposed to be just a lexical declaration
(unless there was more that i missed)

@p6rt

This comment has been minimized.

Copy link
Author

@p6rt p6rt commented Dec 3, 2017

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

@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
Projects
None yet
1 participant
You can’t perform that action at this time.