# New Ticket Created by "Brian S. Julin" # Please include the string: [perl #127018] # in the subject line of all future correspondence about this issue. # <URL: https://rt.perl.org/Ticket/Display.html?id=127018 >
(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