Jon Lang wrote:
> "supersede" already has a meaning with respect to classes; and what
> I'm thinking of would apply to classes as well as roles; so I'm going
> to suggest another keyword.
>
> 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.

Or, perhaps more simply, say that if you "mandate" a method in a role,
you must "supersede" it in whatever you are composing it into in order
to override the definition.  So:

    role R { mandate method foo { ... } }
    class C does R { supersede method foo { ... } }

I'd still recommend the suggest/mandate pairing, and their application
directly to methods or indirectly via the role; the only change is
that "mandate" be redefined as "Thou Shalt Not Override This/These
Methods..." and "supersede" becomes "...Unless You Really Mean It."
Conflicts still occur as normal when composing multiple roles; the
only catch is that you _have to_ resolve them using a supersede method
if any of the conflicting methods are mandated.

Or maybe not.  Perhaps a conflict between composed roles cancels out
the conflicting method implementations whether or not any of them are
mandates, leaving the class free to define its own version.  That is,
the only time you must "supersede" a method is when you're trying to
override a single "mandate" method.

I'd still like to get a synonym for "mandate role", though - a word
that captures the meaning of "unit of behavior".

-- 
Jonathan "Dataweaver" Lang

Reply via email to