in reply to
Re: Roles and functional programming
in thread Roles and functional programming
Roles don't -have- attributes. Roles can -provide- attributes to the classes they are composed into. If you have a Cat and Dog, each of which does Pet, then if you have a $cat instance and a $dog instance, the $.collar attribute of each is separate. They aren't shared in any sense. Therefore, Perl6 roles -are- stateless in that the role itself doesn't have any state. (Which makes sense given that you cannot instantiate a role.)
My criteria for good software:
- Does it work?
- Can someone else come in, make a change, and be reasonably certain no bugs were introduced?