On 31 May 2013 12:01, Damien Cassou <[email protected]> wrote:
> Hi Frank,
>
> On Wed, May 29, 2013 at 11:45 PM, Frank Shearar <[email protected]> 
> wrote:
>> I have a Trait TGroup that requires #*, #identity and #inverse. I want
>> to construct a TField by composing TGroup with itself. One TGroup will
>> form the operations #*, #one, and #reciprocal while the other will
>> form #+, #zero and #negated.
>>
>> I don't want #identity or #inverse, because these apply to one
>> operation, and it makes TField's API ambiguous. That's what
>> TraitExclusion is for.
>
> maybe a diagram would help

In explaining the problem, or an an alternative to the crazy
composition? I rather think that this - which doesn't work, and
prompted the question in the first place - is rather readable... _and
executable_:

    (TGroup @ {#* -> #+. #inverse -> #negated. #identity -> #zero} +
TGroup @ {#inverse -> #reciprocal. #identity -> #zero}) - {#identity.
#inverse}

What I don't understand is
(a) why exclusion only applies to the rightmost trait in the composition and
(b) why aliases either break (in Pharo [1]) or do nothing (in Squeak),
where I'd expected to see implementations saying "self requirement".

frank

[1] https://pharo.fogbugz.com/default.asp?10803#78542

Reply via email to