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

LTA error message for trying to instantiate non-class #3428

Closed
p6rt opened this issue Jul 5, 2014 · 5 comments
Closed

LTA error message for trying to instantiate non-class #3428

p6rt opened this issue Jul 5, 2014 · 5 comments
Labels

Comments

@p6rt
Copy link

p6rt commented Jul 5, 2014

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

Searchable as RT122232$

@p6rt
Copy link
Author

p6rt commented Jul 5, 2014

From @masak

<masak> m​: class A​::B {}; say A.new
<camelia> rakudo-moar 44d535​: OUTPUT«You cannot create an instance of
this type [...]
<masak> ^^ might want a clearer error message.
<jnthn> Including the name rather than "this type" would help, but
there's no good way to get hold of it at the moment.
* masak submits rakudobug
<masak> m​: module A {}; say A.new
<camelia> rakudo-moar 44d535​: OUTPUT«You cannot create an instance of
this type [...]
<masak> m​: class A​::B {}; say A.HOW.^name
<camelia> rakudo-moar 44d535​: OUTPUT«Perl6​::Metamodel​::PackageHOW␤»
<masak> jnthn​: if we just changed the error message to "You tried to
call .new on a package", what wouldn't work out so well?
<jnthn> we don't know it's a package
<jnthn> m​: subset Foo of Int where * > 42; Foo.new
<camelia> rakudo-moar 44d535​: OUTPUT«You cannot create an instance of
this type [...]
<masak> ok, fair enough.
<masak> I suspected something like that might be the case.
<jnthn> There's an Uninstantiable REPR at the bottom of all these.
<masak> *nod*
<masak> but still, an error message saying "Tried to instantiate A but
it is a {A.HOW.^name}" would be ideal, no?
<jnthn> but it isn't a PackageHOW, it's a Package. And you can't make
a method call in a REPR. That's against the rules.
<masak> oh :/
<masak> then I don't know of a good solution.
<jnthn> Don't "oh :/". Those rules keep a dozen other things sane.
<masak> it wasn't disappointment at the rule as such. I'm sure it's a
great rule.
<masak> it was disappointment at the fact that there isn't an easy fix.
<jnthn> If there's any fix, it's to do what method dispatch does,
which is let the HLL supply a handler for such errors, so it can
rewrite them cleanly into some other exception type.
<masak> ok.

@p6rt
Copy link
Author

p6rt commented May 10, 2017

From @MasterDuke17

Fixed in MoarVM/MoarVM@1ba147e
Brought into NQP in Raku/nqp@77fa587
Brought into Rakudo in rakudo/rakudo@33ef5a9
Tests added in rakudo/rakudo#1080

@p6rt
Copy link
Author

p6rt commented May 10, 2017

@MasterDuke17 - Status changed from 'new' to 'resolved'

@p6rt p6rt closed this as completed May 10, 2017
@p6rt p6rt added the Bug label Jan 5, 2020
@usev6
Copy link

usev6 commented May 1, 2021

Just for the record: The link for the fix looks wrong to me. I'm pretty sure it was fixed with MoarVM/MoarVM@40987366fc.

@usev6
Copy link

usev6 commented May 1, 2021

Fix for the JVM backend: Raku/nqp@3ff1af5daa

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

2 participants