Type-checking of attributes is not yet implemented in Rakudo. There's a branch of Rakudo that uses a new object model, which will make it very simple to implement attribute type checking. Expect it to land in the next two or three months.
Once that's done, you can say
subset Username of Str where none <admin root>; class User is rw { has Int $.id; has Username $.username; }
In reply to Re: Perl6: Class attribute strict static type
by moritz
in thread Perl6: Class attribute strict static type
by dièze
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |