# New Ticket Created by Zefram # Please include the string: [perl #126123] # in the subject line of all future correspondence about this issue. # <URL: https://rt.perl.org/Ticket/Display.html?id=126123 >
S02 says this will produce a compiler error: $ ./perl6 -e 'my Int $a of Str; say "hi"' hi The actual result is that the "of" type is used, and the prefix type is mostly ignored. (Not entirely ignored: along the lines of [perl #126107], the variable gets its default value from the prefix type, even if that's inconsistent with the "of" type.) It's also possible to give two (clashing) "of" types, if the two "of" clauses are separated by another clause: $ ./perl6 -e 'my Int $a of Str is default("z") of Rat; say "hi"' hi The last "of" type is used as the type constraint. (But again per [perl #126107] the default stays even if it's inconsistent with that type.) Presumably multiple type constraint clauses, however expressed, should signal an error. It might be OK to permit multiple type constraints specifying exactly the same type, but I don't see a real benefit to that. It seems better to forbid multiple specification whether they clash or not. -zefram