NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.
All the Perl that's Practical to Extract and Report
Stories, comments, journals, and other submissions on use Perl; are Copyright 1998-2006, their respective owners.
have we heard this before? (Score:1)
Flattened, composable behavior -- sounds like traits [unibe.ch].
;-)
-- dagolden
Re: (Score:2)
I've read through that a number of times and I think they're right. There are, however, a couple of key differences. First, they don't have state with their traits (see bottom of page two in Traits: Composable Units of Behaviour [unibe.ch]). I think that's a mistake and so does Perl 6 and Moose. Smalltalk traits only share behavior, not data.
Second, they're not advocating eliminating inheritance. They're advocating eliminating MI and mixins and using traits for allomorphic properties. I'm thinking that perhaps t
Re: (Score:1)
I agree the local class overriding role can seem confusing, but over the past few years of using roles pretty heavily I have come to appreciate this feature quite a lot. It actually makes the roles more re-usable since it is very easy to locally override something. Yes it does destroy some of the black-box-ness of Roles, but honestly I have not found roles to be very useful unless you can look inside and see what they provide/do. I have come to kind of see Roles as being more semi-transparent then opaque,
Re:have we heard this before? (Score:1)
I thought that part of the point of having traits flatten at compile time was to require that kind of override to have explicit disambiguation. So you can locally override, but it's called out in the code.
Maybe a bad example, but for the sake of debate:
Excluding 'doit' from Foo without providing it in Bar would also be an error, of course.
-- dagolden
Reply to This
Parent
Re: (Score:1)
When traits/roles are applied to classes the local class overrides the role, but the role overrides the superclass. When traits/roles are applied to other traits/roles they are merged together into a composite role and that is where this kind of disambiguation is needed. This cookbook recipe [cpan.org] shows both aliasing and exclusion of role methods, this is a feature directly taken from the traits papers but which Perl 6 has not decided to include.
- Stevan
Re: (Score:2)
This cookbook recipe shows both aliasing and exclusion of role methods, this is a feature directly taken from the traits papers but which Perl 6 has not decided to include.
You know, I was wondering why I hadn't seen that in Perl 6. What does that last bit mean, though? That Perl 6 is not yet decided or that they've decided not to offer this? (I'll try and reread the spec tomorrow)
Re: (Score:1)
Perl 6 does not provide ways to explictly exclude or alias methods during compsition (well not that I have seen anyway, cause I don't follow it much these days).
- Stevan