I'm interested in helping to write some tests for "return types", but I'd like some clarifications about them first. Are they just "declarations" that help Perl optimize stuff, or they actually contracts?
As this little script shows, both "inner" and "of" are valid syntax now with pugs, but neither is considered an error to throw an error when the different type is actually returned. I'd like see it documented in exactly what cases errors should be thrown here. For reference, return are described here: http://feather.perl6.nl/syn/S06.html#Return_types demo: sub foo of Array { my %h = ( a => 1 ); return %h; } sub zoo returns Array { my %h = ( a => 1 ); return %h; } # Hashes are happily returned, despite the Array return types. my %b = foo(); say %b.perl; my %c = foo(); say %c.perl;