I want to create an (:around qualified) specializer of initialize-instance for a class X that will first call-next-method and then will call make-instance of another class, supplying it with the created instance of X. How can i get hold of the created instance inside initialize-instance :around method? (assuming of course after having called call-next-method so we are at the finilizing side of :around)
EDIT:
Class A has a bi-directional relationship with Class B through a slot in each one that keeps the id of the other, but class A requires id of class B, while the opposite is not required. So the flow i want is:
- make-instance ‘classA
-
inside initialize-instance :around classA I would have:
i. make-instance classB and aquire id-of-B.
ii call-next-method adding id-of-B
iii set the corresponding id-of-A slot of classB point to our created classA instance (this is my original question reason)
Now I could do [i] in :before and [iii] in :after, but i cant:
Classes A and B are persistent classes through elephant and I want to wrap the whole flow in a transaction which I wouldnt like to span many methods. For those familiar with elephant, I want to use ensure-transaction wrapper, and I dont want to use explicit begin and commit function calls in different points.
The instance is passed as the first argument of
initialize-instance.