Open NicolasAnquetil opened 4 years ago
see moosetechnology/Moose#2070
may be a method like: #applyAssociation:fromSide:toSide: or withFrom:withTo: or fromRole:toRole: ...
Currently to create an association such as Invocation, we must:
#defineClasses
#defineHierarchy
TInvocable
TWithInvocations
TInvocation
Things happen in two methods (#defineClasses
and #defineHierarchy
), often lines are separated because the classes have other properties/inheritances, so the information is scattered which does not make clear the creation of a relationship.
Improvement initially wished was to create classes as usual and define the relationship (i.e. uses of traits) in #defineRelations
:
apply: TInvocation on: Invok-class withFrom: Invoker-class withTo: Invoked-class
But we don't have identification of from/to slots in TInvocation
so we cannot compute the trait needed by the from/to sides.
Two possible solutions:
#defineClasses
+ a method with 6 parameters:applyAssociation: TInvocation on: Invok-class fromSlot: #sender on: Invoker-class toSlot: #candidates on: Invoked-class
(sender
is the from slot in TInvocation
and candidates
is the to slot)
TInvocation
(and no other!) in #defineHierarchy
:applyAssociation: Invok-class fromSlot: #sender on: Invoker-class toSlot: #candidates on: Invoked-class
FmxMBRelationSide>>source
and FmxMBRelationSide>>target
which could be some basis for this ...
just like
#apply:on:oppositeTraits:on:
for "reciprocal traits", there could be a generator method to simplify creating association between two classes