Constrained genericity: Difference between revisions
Content added Content deleted
Thundergnat (talk | contribs) m (→{{header|Perl 6}}: Fix broken example.) |
|||
Line 955: | Line 955: | ||
=={{header|Perl 6}}== |
=={{header|Perl 6}}== |
||
{{works with|Rakudo| |
{{works with|Rakudo|2016.01}} |
||
{{broken|Perl 6}} |
|||
<lang perl6>subset Eatable of Any where { .^can('eat') }; |
<lang perl6>subset Eatable of Any where { .^can('eat') }; |
||
class Cake { method eat() {...} } |
class Cake { method eat() {...} } |
||
role FoodBox[Eatable |
role FoodBox[Eatable] { |
||
has |
has %.foodbox; |
||
} |
} |
||