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

Some core Routines do not do Callable role #5561

Open
p6rt opened this issue Aug 12, 2016 · 6 comments
Open

Some core Routines do not do Callable role #5561

p6rt opened this issue Aug 12, 2016 · 6 comments
Labels

Comments

@p6rt
Copy link

p6rt commented Aug 12, 2016

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

Searchable as RT128905$

@p6rt
Copy link
Author

p6rt commented Aug 12, 2016

From @zoffixznet

To me this looks like a bug, or at least an inconsistency. The failure to do a Callable means it can't be accepted into (&thing) in routines, which is how I discovered this​:

m​: say Any.^can("push")[0] ~~ Callable;
rakudo-moar c587b9​: OUTPUT«False␤»

m​: say Any.^can("push")[0].^mro
rakudo-moar c587b9​: OUTPUT«((Method+{<anon|42801984>}) (Method) (Routine) (Block) (Code) (Any) (Mu))␤»

m​: say Any.^can("say")[0].^mro
rakudo-moar c587b9​: OUTPUT«((Method) (Routine) (Block) (Code) (Any) (Mu))␤»

m​: sub (&thing) {}( Any.^can("push")[0] )
rakudo-moar c587b9​: OUTPUT«Type check failed in binding to &thing; expected Callable but got Method+{<anon|42801984>} (Method+{<anon|4280198...)␤ in sub at <tmp> line 1␤ in block <unit> at <tmp> line 1␤␤»

m​: sub (&thing) {}( Any.^can("say")[0] )
rakudo-moar c587b9​: ( no output )

@p6rt
Copy link
Author

p6rt commented Aug 12, 2016

From @lizmat

The only difference between “push” and “say” I can find, is that “push” is marked “is nodal”

However, trying to replicate this outside of the setting, does work as expected​:

$ 6 'class A { proto method a() is nodal { } }; say A.^can("a")[0] ~~ Callable
True

Looks like it is even deeper, at the nqp level​:

$ 6 'use nqp; say nqp​::istype(Any.^can("push")[0],Callable)’
0

Not sure where to go from here yet

On 12 Aug 2016, at 05​:32, Zoffix Znet (via RT) <perl6-bugs-followup@​perl.org> wrote​:

# New Ticket Created by Zoffix Znet
# Please include the string​: [perl #​128905]
# in the subject line of all future correspondence about this issue.
# <URL​: https://rt-archive.perl.org/perl6/Ticket/Display.html?id=128905 >

To me this looks like a bug, or at least an inconsistency. The failure to do a Callable means it can't be accepted into (&thing) in routines, which is how I discovered this​:

m​: say Any.^can("push")[0] ~~ Callable;
rakudo-moar c587b9​: OUTPUT«False␤»

m​: say Any.^can("push")[0].^mro
rakudo-moar c587b9​: OUTPUT«((Method+{<anon|42801984>}) (Method) (Routine) (Block) (Code) (Any) (Mu))␤»

m​: say Any.^can("say")[0].^mro
rakudo-moar c587b9​: OUTPUT«((Method) (Routine) (Block) (Code) (Any) (Mu))␤»

m​: sub (&thing) {}( Any.^can("push")[0] )
rakudo-moar c587b9​: OUTPUT«Type check failed in binding to &thing; expected Callable but got Method+{<anon|42801984>} (Method+{<anon|4280198...)␤ in sub at <tmp> line 1␤ in block <unit> at <tmp> line 1␤␤»

m​: sub (&thing) {}( Any.^can("say")[0] )
rakudo-moar c587b9​: ( no output )

@p6rt
Copy link
Author

p6rt commented Aug 12, 2016

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

@p6rt
Copy link
Author

p6rt commented Aug 30, 2017

From @zoffixznet

Looks like this bug affects subroutines too​:

m​: say &defined ~~ Callable
rakudo-moar 3e1382​: OUTPUT​: «False␤»

m​: say [0,1,2,Any].grep(&defined)
rakudo-moar 3e1382​: OUTPUT​: «Cannot resolve caller ACCEPTS(Sub+{<anon|56691824>}​: Int); <redacted>

@p6rt
Copy link
Author

p6rt commented Dec 14, 2017

From @zoffixznet

Also affects some methods​:

<Zoffix__> m​: my %h; say %h.AT-KEY​: 1|2
<camelia> rakudo-moar eaf609edb​: OUTPUT​: «Type check failed in binding to parameter '&call'; expected Callable but got Method+{is-nodal} (Method+{is-nodal}.new)␤ in block <unit> at <tmp> line 1␤␤»

@p6rt
Copy link
Author

p6rt commented Dec 14, 2017

From @zoffixznet

On Wed, 13 Dec 2017 19​:23​:38 -0800, cpan@​zoffix.com wrote​:

Also affects some methods​:

<Zoffix__> m​: my %h; say %h.AT-KEY​: 1|2
<camelia> rakudo-moar eaf609edb​: OUTPUT​: «Type check failed in binding
to parameter '&call'; expected Callable but got Method+{is-nodal}
(Method+{is-nodal}.new)␤ in block <unit> at <tmp> line 1␤␤»

This bug is blocking a potential fix for RT#​125614[^1]. If you fix this ticket, please take a look if the fix for that other one can be merged.

[1] https://rt-archive.perl.org/perl6/Ticket/Display.html?id=125614

@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