Raphael Descamps wrote:
> Am Freitag, den 10.07.2009, 17:06 -0700 schrieb Jon Lang:
>> How about this: in role composition, "mandate" causes methods to take
>> precedence over other methods with which they would normally conflict,
>> and to conflict with methods that would normally take precedence over
>> them.
> I really dislike this because it is contrary to the original idea of the
> "stateless traits" as defined in the original paper from Nathanael
> Schärli.

Agreed.  OTOH, Roles are already contrary in this respect, because
they can provide attributes as well as methods.  Note also that this
was my first proposal; I have since abandoned it in favor of (I hope)
a more intuitive approach.

> The main reason why "traits" have been introduced was to solve the
> problems inherent to mixins. In mixins the main problem is that the
> class using the mixin is not able to control the composition (which is
> simply done sequencially) and that lend to fragile hierarchies.
> The brilliant idea with "traits" is that it bring back the control to
> the class consuming the "trait" and conflicts have to be solved
> explicitly. The traits paper propose 3 different operators to solve such
> conflicts: overriding, excluding or aliasing.
> I definitively think that perl 6 roles should also have an excluding
> operator because I think that *every* composition conflicts arising
> should be solvable by the class comsuming the role.
> What you propose here is a step behind: you reintroduce the problem
> existing with mixins by bringing back precedence rules in the way
> composition is made.

Well, yes and no.  The class still has the final say on how a given
method is to be implemented; the only thing being debated here is
whether or not the class should have to explicitly pull rank to
redefine a method being provided by a role, or if it does so silently.
 The latter approach is how things currently stand, and is being
criticized as a source of bugs as authors of classes inadvertently
override method definitions that they didn't intend to override.

> So far, I have only seen reference to the original paper decribing the
> "stateless traits". As roles are an implementation of "stateful traits",
> maybe we should start to point to the paper formalising it:
> http://scg.unibe.ch/archive/papers/Berg07eStatefulTraits.pdf

Thanks for the link.

Jonathan "Dataweaver" Lang

Reply via email to