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

Owner: Nobody
Requestors: alex.jakimenko [at] gmail.com
Cc:
AdminCc:

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



From: Aleks-Daniel Jakimenko-Aleksejev <alex.jakimenko [...] gmail.com>
Date: Wed, 9 Dec 2015 18:11:33 +0200
To: rakudobug [...] perl.org
Subject: .WHAT does not allow spaces around the dot (42 . WHAT)
Download (untitled) / with headers
text/plain 888b
Code:
say 42 .WHAT

Result:
===SORRY!===
Method call must either supply a name or have a child node that evaluates to the name


Well, I think that it should work. One practical use is 「^42 .WHAT」.

Some explanation:

<psch> well, .WHAT anywhere in a space-y method call chain didn't work with
             the original commit either
<psch> so it's at least not a regression
<AlexDaniel> okay, interesting
<psch> probably 'cause .WHAT doesn't go the normal
             QAST::Op(:op<callmethod>,...) route
<moritz> right, it's macro-Y
<psch> which fits the error message, 'cause we apparently build such an Op but
             don't populate the children correctly, because .WHAT isn't a method
             that can be called with callmethod


Well, if it is not supposed to work, then at least the error message should be awesome. Right now it doesn't even mention the line number.
RT-Send-CC: perl6-compiler [...] perl.org
Download (untitled) / with headers
text/plain 1.4k
On Wed, 09 Dec 2015 08:12:00 -0800, alex.jakimenko@gmail.com wrote: Show quoted text
> Code: > say 42 .WHAT > > Result: > ===SORRY!=== > Method call must either supply a name or have a child node that evaluates > to the name > > > Well, I think that it should work. One practical use is 「^42 .WHAT」. > > Some explanation: > > <psch> well, .WHAT anywhere in a space-y method call chain didn't work with > the original commit either > <psch> so it's at least not a regression > <AlexDaniel> okay, interesting > <psch> probably 'cause .WHAT doesn't go the normal > QAST::Op(:op<callmethod>,...) route > <moritz> right, it's macro-Y > <psch> which fits the error message, 'cause we apparently build such an Op > but > don't populate the children correctly, because .WHAT isn't a > method > that can be called with callmethod > > > Well, if it is not supposed to work, then at least the error message should > be awesome. Right now it doesn't even mention the line number.
+1 on fixing this or improving error message. In my production code I encountered this bug while trying to test the term's type object and I added the space after the method to align stuff: is make-temp-path.WHAT === IO::Path, *.not, 'made path is not === IO::Path'; is make-temp-dir .WHAT === IO::Path, *.not, 'made dir is not === IO::Path'; The second line crashed. The current error doesn't even include a location, so it has the potential for a tedious bug hunt.
RT-Send-CC: perl6-compiler [...] perl.org
Download (untitled) / with headers
text/plain 1.7k
On Sun, 04 Jun 2017 11:19:57 -0700, cpan@zoffix.com wrote: Show quoted text
> On Wed, 09 Dec 2015 08:12:00 -0800, alex.jakimenko@gmail.com wrote:
> > Code: > > say 42 .WHAT > > > > Result: > > ===SORRY!=== > > Method call must either supply a name or have a child node that > > evaluates > > to the name > > > > > > Well, I think that it should work. One practical use is 「^42 .WHAT」. > > > > Some explanation: > > > > <psch> well, .WHAT anywhere in a space-y method call chain didn't > > work with > > the original commit either > > <psch> so it's at least not a regression > > <AlexDaniel> okay, interesting > > <psch> probably 'cause .WHAT doesn't go the normal > > QAST::Op(:op<callmethod>,...) route > > <moritz> right, it's macro-Y > > <psch> which fits the error message, 'cause we apparently build such > > an Op > > but > > don't populate the children correctly, because .WHAT > > isn't a > > method > > that can be called with callmethod > > > > > > Well, if it is not supposed to work, then at least the error message > > should > > be awesome. Right now it doesn't even mention the line number.
> > > +1 on fixing this or improving error message. > > In my production code I encountered this bug while trying to test the > term's type object > and I added the space after the method to align stuff: > > is make-temp-path.WHAT === IO::Path, *.not, 'made path is not === > IO::Path'; > is make-temp-dir .WHAT === IO::Path, *.not, 'made dir is not === > IO::Path'; > > The second line crashed. > > The current error doesn't even include a location, so it has the > potential for a tedious bug hunt.
Hit on this bug again. Even while knowing you can't put spaces before .WHAT, it took me a couple of minutes trying to find where this error was coming from.


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

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