[perl #128880] [BUG] Dead code in HyperWhatever, 「.new」 is not supposed to work but it does (HyperWhatever.new)

2018-02-11 Thread Zoffix Znet via RT
On Tue, 09 Aug 2016 15:25:11 -0700, alex.jakime...@gmail.com wrote:
> Let's look at the code in Rakudo! From src/core/Whatever.pm
> 
> my class HyperWhatever {
> multi method new(HyperWhatever:) { X::Cannot::New.new(class =>
> self).throw }
> …
> }
> 
> So it seems like it should throw a warning if we try to create a
> HyperWhatever
> object, right? Let's see!
> 
> Code:
> say HyperWhatever.new
> 
> Result:
> sub (*@_) { #`(Sub|54745104) ... }
> 
> 
> Apparently, the code in “.new” method of Whatever.pm is not being
> reached.


Thank you for the report. This is now fixed.

Fix:  https://github.com/rakudo/rakudo/commit/57a1aa7a87
Test: https://github.com/perl6/roast/commit/dbe43e171d7a


On Thu, 11 Aug 2016 20:41:53 -0700, c...@zoffix.com wrote:
> Bizarrely, SourceBaby points to the right place, so I don't get why it
> doesn't work:
> https://github.com/rakudo/rakudo/blob/c587b9d/src/core/Whatever.pm#L10

On Sun, 18 Dec 2016 13:18:36 -0800, c...@zoffix.com wrote:
> No idea if there's any easy way to make it DTRT, so I'm going to leave
> this for someone else...

It's OK, 2016-Zoffix. I got your back, bruh.
Took me like 3 minutes to figure out the fix.


[perl #128880] [BUG] Dead code in HyperWhatever, 「.new」 is not supposed to work but it does (HyperWhatever.new)

2018-02-11 Thread Zoffix Znet via RT
On Tue, 09 Aug 2016 15:25:11 -0700, alex.jakime...@gmail.com wrote:
> Let's look at the code in Rakudo! From src/core/Whatever.pm
> 
> my class HyperWhatever {
> multi method new(HyperWhatever:) { X::Cannot::New.new(class =>
> self).throw }
> …
> }
> 
> So it seems like it should throw a warning if we try to create a
> HyperWhatever
> object, right? Let's see!
> 
> Code:
> say HyperWhatever.new
> 
> Result:
> sub (*@_) { #`(Sub|54745104) ... }
> 
> 
> Apparently, the code in “.new” method of Whatever.pm is not being
> reached.


Thank you for the report. This is now fixed.

Fix:  https://github.com/rakudo/rakudo/commit/57a1aa7a87
Test: https://github.com/perl6/roast/commit/dbe43e171d7a


On Thu, 11 Aug 2016 20:41:53 -0700, c...@zoffix.com wrote:
> Bizarrely, SourceBaby points to the right place, so I don't get why it
> doesn't work:
> https://github.com/rakudo/rakudo/blob/c587b9d/src/core/Whatever.pm#L10

On Sun, 18 Dec 2016 13:18:36 -0800, c...@zoffix.com wrote:
> No idea if there's any easy way to make it DTRT, so I'm going to leave
> this for someone else...

It's OK, 2016-Zoffix. I got your back, bruh.
Took me like 3 minutes to figure out the fix.


[perl #128880] [BUG] Dead code in HyperWhatever, 「.new」 is not supposed to work but it does (HyperWhatever.new)

2016-12-18 Thread Zoffix Znet via RT
On Tue, 09 Aug 2016 15:25:11 -0700, alex.jakime...@gmail.com wrote:
> Let's look at the code in Rakudo! From src/core/Whatever.pm
> 
> my class HyperWhatever {
> multi method new(HyperWhatever:) { X::Cannot::New.new(class =>
> self).throw }
> …
> }
> 
> So it seems like it should throw a warning if we try to create a
> HyperWhatever
> object, right? Let's see!
> 
> Code:
> say HyperWhatever.new
> 
> Result:
> sub (*@_) { #`(Sub|54745104) ... }
> 
> 
> Apparently, the code in “.new” method of Whatever.pm is not being
> reached.


Dug a bit more into it... It's getting interpreted as an attempt to 
hyper-whatever a .new call (so like **.new), and the QAST gets added a call to 
&HYPERWHATEVER, which returns the sub you see in the output.

No idea if there's any easy way to make it DTRT, so I'm going to leave this for 
someone else...