# New Ticket Created by "Carl Mäsak" # Please include the string: [perl #110918] # in the subject line of all future correspondence about this issue. # <URL: https://rt.perl.org:443/rt3/Ticket/Display.html?id=110918 >
<masak> std: my int ($a, $b) <p6eval> std 52f3895: OUTPUT«ok 00:01 110m» <masak> nom: my int ($a, $b); say 'alive' <p6eval> nom f9fcb2: OUTPUT«Lexical '$a' is of wrong register type in lexical lookup [...] * masak submits rakudobug <masak> nom: my (int $a, int $b); say 'alive' <p6eval> nom f9fcb2: OUTPUT«Lexical '$a' is of wrong register type in lexical lookup [...] <masak> huh! <masak> nom: my (int $a); say 'alive' <p6eval> nom f9fcb2: OUTPUT«Lexical '$a' is of wrong register type in lexical lookup [...] <masak> nom: my int $a; say 'alive' <p6eval> nom f9fcb2: OUTPUT«alive» <masak> still a bug, but not what I thought it was :) All the declarations above should either Just Work, or throw a better error message. I have no idea whether the 'my int ($a, $b)' form is meant to work, but STD.pm6 seems to accept it. The strange error messages above seem specific to native types, but other types are problematic too, in that they are not checked if declared inside the signature: <masak> nom: my (Int $a); $a = "OH HAI"; say 'alive' <p6eval> nom f9fcb2: OUTPUT«alive» <masak> nom: my (Int $a, Int $b); $b = "OH HAI"; say 'alive' <p6eval> nom f9fcb2: OUTPUT«alive» Declaring a type the normal way works, of course. <masak> nom: my Int $a; $a = "OH HAI"; say 'alive' <p6eval> nom f9fcb2: OUTPUT«Type check failed in assignment to '$a'; expected 'Int' but got 'Str' [...] Having the type declarations within parentheses mean nothing violates Least Surprise.