# New Ticket Created by  "Carl Mäsak" 
# Please include the string:  [perl #122232]
# in the subject line of all future correspondence about this issue. 
# <URL: https://rt.perl.org/Ticket/Display.html?id=122232 >


<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.

Reply via email to