Skip Menu |
Report information
Id: 124442
Status: open
Priority: 0/
Queue: perl6

Owner: Nobody
Requestors: rjbs <rjbs [at]>

Severity: (no value)
Tag: Bug
Platform: (no value)
Patch Status: (no value)
VM: (no value)

Date: Sat, 2 May 2015 14:28:46 -0400
From: Ricardo Signes <rjbs [...]>
To: rakudobug [...]
Subject: no warning when a subroutine named "byte" is created
Download (untitled) / with headers
text/plain 305b
This confused the heck out of me: ~/code/hub/rakudo$ ./perl6 -e 'sub byte ($i) { $i } ; say byte(1)' Cannot invoke this object (REPR: P6int, cs = 0) in block <unit> at -e:1 I can imagine being happy with (a) a warning when I defined the sub or (b) a better runtime error of some sort. -- rjbs
Date: Wed, 2 Sep 2015 14:21:57 -0400
Subject: [perl #124442] no warning when a subroutine named "byte" is created
To: perl6-bugs-followup [...]
From: bri <bri [...]>
Download (untitled) / with headers
text/plain 848b
This is actually a more generic problem affecting user-created classes as well: $ perl6 -e 'class b { }; { my &b; say b.WHAT, b().WHAT }' (b)(b(Any)) is just that the native types have no idea what to do when invoked and are noisier. The above results could be equally surprizing for someone expecting &b to get called. If there is something in the spec that says that an outer class namespace should be considered before the inner sub namespace I have not seen it. When the sub is scoped more inner than the class, I would expect the sub to win all constructs where using it is vaid to use, personally, I would also expect the invocation to prefer a sub over a type when both are defined in the same scope for b(), but in this case an argument could be made either way about the bareword (and perhaps that should die as amibiguous.)
Download (untitled) / with headers
text/plain 280b
Looks like a bug to me as well. Simpler example: ➜ class a {}; { sub a {42}; say a } (a) ➜ class a {}; { sub a {42}; say a() } Method 'shortname' not found for invocant of class 'Perl6::Metamodel::CoercionHOW' in block <unit> at -e line 1 (a)

This service is sponsored and maintained by Best Practical Solutions and runs on infrastructure.

For issues related to this RT instance (aka "perlbug"), please contact perlbug-admin at