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

Dead code in HyperWhatever, 「.new」 is not supposed to work but it does (HyperWhatever.new) #5551

Closed
p6rt opened this issue Aug 9, 2016 · 6 comments
Labels

Comments

@p6rt
Copy link

p6rt commented Aug 9, 2016

Migrated from rt.perl.org#128880 (status was 'resolved')

Searchable as RT128880$

@p6rt
Copy link
Author

p6rt commented Aug 9, 2016

From @AlexDaniel

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.

@p6rt
Copy link
Author

p6rt commented Aug 12, 2016

From @zoffixznet

On Tue Aug 09 15​:25​:11 2016, alex.jakimenko@​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.

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

I tried copying that little bit into a test file and rename the class to HyperWhatever2 and invoke the new and then it throws fine.

http://irclog.perlgeek.de/perl6-dev/2016-08-12#i_13009979

@p6rt
Copy link
Author

p6rt commented Aug 12, 2016

The RT System itself - Status changed from 'new' to 'open'

@p6rt
Copy link
Author

p6rt commented Dec 18, 2016

From @zoffixznet

On Tue, 09 Aug 2016 15​:25​:11 -0700, alex.jakimenko@​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...

@p6rt
Copy link
Author

p6rt commented Feb 11, 2018

From @zoffixznet

On Tue, 09 Aug 2016 15​:25​:11 -0700, alex.jakimenko@​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​: rakudo/rakudo@57a1aa7a87
Test​: Raku/roast@dbe43e171d7a

On Thu, 11 Aug 2016 20​:41​:53 -0700, cpan@​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, cpan@​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.

@p6rt
Copy link
Author

p6rt commented Feb 11, 2018

@zoffixznet - Status changed from 'open' to 'resolved'

@p6rt p6rt closed this as completed Feb 11, 2018
@p6rt p6rt added the Bug label Jan 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant