TSa wrote:
> HaloO,
>
> Jon Lang wrote:
>>
>> 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.
>
> I think the distinction can be made implicitly. Methods in a role
> with no implementation are silently overridden. Ones with an
> implementation produce a warning if the composing class overrides
> it without some extra syntax. This bites only the case where the
> role provides a default implementation intended for overriding.

Perhaps.  FWIW, applying the "supersede" keyword to the class method
would work as the "extra syntax" to which you refer.  Your last
sentence is pointing to the distinction that I was trying to make with
the "mandate"/"suggest" pairing.

For clarity, let me propose the following terminology: an "interface"
is a role with methods that suggest their implementations by default;
a "mixin" is a role with methods that mandate their implementations by
default.  I could see adopting one of these terms as a variation on
"role" and treating "role" itself as the other one; if we do this,
which would be preferable: interfaces and roles, or roles and mixins?
That is: when you think "role", do you think of the interface
semantics or the mixin semantics most readily?

-- 
Jonathan "Dataweaver" Lang

Reply via email to