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


<masak> m: role A::B {}; sub foo(A $a) {}
<camelia> rakudo-moar 662447: OUTPUT«===SORRY!=== Error while
compiling /tmp/TNiNkxUsdd␤Type A cannot be used as a nominal type on a
parameter [...]
* masak submits LTA rakudobug
<masak> it's true that A, which is in some sense less real than A::B
(or not "inhabited" or whatever), but the error message should explain
that.
<masak> it's especially confusing that it calls A a "type".
<masak> in fact, I think it would be enough if it just said
"Containing package A cannot be used..."
<moritz> m: package A { }; sub foo(A $a) { }
<camelia> rakudo-moar 662447: OUTPUT«===SORRY!=== Error while
compiling /tmp/VqZ7Dwi6I3␤Type A cannot be used as a nominal type on a
parameter [...]
<moritz> masak: not just containing packages
<masak> good point.
<masak> I mean, in some sense A is a type. in both cases.
<jnthn> It's not even "in some sense".
<masak> but the fact that it's not enough of a useful type is the more
important fact to highlight in the message.
<masak> it's not the kind of type to be used for typing :)
<jnthn> The message is already a LOT better than it just not accepting
anything at runtime.
<masak> granted.
<masak> m: role A::B {}; sub foo($a) { say $a }; foo(A)
<camelia> rakudo-moar 662447: OUTPUT«(A)␤»
<masak> I mean, passing these things ain't a problem.
<jnthn> Just remove the word "Type" at the start of the error and it's
probably a lot less misleading.
<masak> +1
<jnthn> Or at least, less scizophrenic :)

Reply via email to