develooper Front page | perl.perl6.compiler | Postings from July 2012

[perl #113964] [BUG] LTA error message when passing to a typed slurpy array parameter in Rakudo

From:
Carl Mäsak
Date:
July 3, 2012 03:38
Subject:
[perl #113964] [BUG] LTA error message when passing to a typed slurpy array parameter in Rakudo
Message ID:
rt-3.6.HEAD-28836-1341311891-1902.113964-82-0@perl.org
# New Ticket Created by  "Carl Mäsak" 
# Please include the string:  [perl #113964]
# in the subject line of all future correspondence about this issue. 
# <URL: https://rt.perl.org:443/rt3/Ticket/Display.html?id=113964 >


<seldon> Can slurpy parameters not be typed? I'm having trouble with
sub foo(Int *@numbers) { }; Rakudo tells me "Nominal type check failed
for parameter '@numbers'; expected Positional but got Array instead"
<masak> hm.
<jnthn> I believe they cannot be.
<masak> r: sub foo(Int *@numbers) {}; foo(5, 42)
<p6eval> rakudo ee8ca1: OUTPUT«Nominal type check failed for parameter
'@numbers'; expected Positional but got Array instead [...]
<masak> in any case, that's a crappy error message.
<masak> r: say Array ~~ Positional
<p6eval> rakudo ee8ca1: OUTPUT«True␤»
<masak> was gonna say.
* masak submits LTA rakudobug
<jnthn> It's missing the type info for some reason.
<jnthn> We should perhaps just forbid the type on slurpies at all though
<jnthn> As in, catch it much earlier at compile time and say "this won't work"
<masak> aye.
<masak> that's the conservative thing to do.



nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About