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 HOWs delegate .can to Mu, producing [LTA] error #4923

Open
p6rt opened this issue Dec 24, 2015 · 1 comment
Open

Some HOWs delegate .can to Mu, producing [LTA] error #4923

p6rt opened this issue Dec 24, 2015 · 1 comment

Comments

@p6rt
Copy link

p6rt commented Dec 24, 2015

Migrated from rt.perl.org#127018 (status was 'new')

Searchable as RT127018$

@p6rt
Copy link
Author

p6rt commented Dec 24, 2015

From @skids

(12​:04​:56 AM) cxreg​: skids​: i discovered this trying to go through the exercism perl6 set
(12​:04​:57 AM) skids​: m​: unit module Foo; Foo.can("bar").say
(12​:04​:58 AM) camelia​: rakudo-moar e34842​: OUTPUT«Too many positionals passed; expected 2 arguments but got 3␤ in block <unit> at /tmp/CZGBnLKJ1h line 1␤␤»
(12​:05​:26 AM) skids​: Which is probaby related to​:
(12​:05​:29 AM) cxreg​: ah there we go
(12​:05​:37 AM) skids​: m​: unit module Foo; Foo.HOW.WHAT.say;
(12​:05​:38 AM) camelia​: rakudo-moar e34842​: OUTPUT«(ModuleHOW)␤»
(12​:06​:03 AM) skids​: m​: unit module Foo; Foo.HOW.WHAT.say; class Foo { }; Foo.HOW.WHAT.say;
(12​:06​:04 AM) camelia​: rakudo-moar e34842​: OUTPUT«(ModuleHOW)␤(ClassHOW)␤»
(12​:07​:40 AM) cxreg​: and the fact that that "shadowing" acts differently across compunits? not sure if even doing so should be allowed
(12​:13​:05 AM) skids​: cxreg​: I think it is actually correct behavior, just an LTA error.
(12​:13​:34 AM) skids​: When you do "unit module Foo; class Foo { }" you are defining class Foo​::Foo.
(12​:15​:14 AM) cxreg​: oh, and in the other unit (outside of that lexical scope) Foo is the module but inside it becomes the class?
(12​:15​:47 AM) cxreg​: ok that appears correct
(12​:16​:04 AM) skids​: Right, but a module should probably have a better response to .can and such than "not enough args"
(12​:17​:14 AM) cxreg​: hilariously, if you pass no args it says too few
(12​:17​:32 AM) skids​: m​: unit module Foo; Foo.^find_method("can").candidates».signature.say
(12​:17​:32 AM) camelia​: rakudo-moar e34842​: OUTPUT«((Mu \SELF​: $name, *%_))␤»
(12​:18​:33 AM) skids​: m​: unit module Foo; Foo.can(Foo,"bar").say;
(12​:18​:34 AM) camelia​: rakudo-moar e34842​: OUTPUT«Too many positionals passed; expected 2 arguments but got 3␤ in block <unit> at /tmp/7oQB6CzE42 line 1␤␤»
(12​:24​:09 AM) skids​: Ah, it's because ^can a.k.a. ModuleHOW.can defaults back to Mu's .can, where HOW methods get passed HOW,obj,<args>
(12​:24​:59 AM) skids​: But Mu's non-introspective form just wants obj,<args>
(12​:32​:03 AM) cxreg​: skids++
(12​:34​:37 AM) skids​: m​: unit package Foo; Foo.can(Foo,"bar").say;
(12​:34​:38 AM) camelia​: rakudo-moar e34842​: OUTPUT«Too many positionals passed; expected 2 arguments but got 3␤ in block <unit> at /tmp/yJ8HQrnpRQ line 1␤␤»
(12​:35​:52 AM) skids​: m​: Str(Any).can("foo")
(12​:35​:53 AM) camelia​: rakudo-moar e34842​: OUTPUT«Method 'can' not found for invocant of class 'Perl6​::Metamodel​::CoercionHOW'␤ in block <unit> at /tmp/mbrRcP_CwR line 1␤␤»
(12​:36​:11 AM) skids​: That does not inherit .can from Mu apparently
(12​:38​:01 AM) skids​: m​: (subset Foo of Str).can("foo").say
(12​:38​:02 AM) camelia​: rakudo-moar e34842​: OUTPUT«Too many positionals passed; expected 2 arguments but got 3␤ in block <unit> at /tmp/cOaqEq0HCQ line 1␤␤»

Basically anything that is Mu and does not Metamodel​::MROBasedMethodDispatch

http://irclog.perlgeek.de/perl6/2015-12-24#i_11768638 for full dialogue

cxreg++ for noticing
AlexDaniel++ too

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