[furcas-discussion] Element re-use strategy for foreach
Uhl, Axel
axel.uhl at sap.com
Fri Feb 18 15:40:06 CET 2011
Hi,
the existing foreach code, if I understand it correctly, is trying to re-use elements based on a comparison of the used Template's metaReference (an EClass) and the eClass() of the object already in the target feature. If these classes match up, the existing element is re-used and entered into the ModelElementProxy instead of creating a new one.
But what if there are multiple when-clauses using different templates for the same class, distinguished by different modes? Then the target elements would need to be produced by different rules in different ways.
Wouldn't re-using an element produced by a differently-moded template for the same class lead to also re-using a potentially wrong object state?
We also seem to be missing information about which template was used to produce the target element as there is no separate TextBlock/correspondingModelElement combination for the foreach target elements. Instead, we only have the ForEachContext elements, but they currently don't document the template that was used to create the target element.
Suggestion: let's add a reference to ForEachContext which points to the Template used to produce the element held in the resultModelElement reference.
What do you say?
-- Axel
More information about the Furcas-discussion
mailing list