Open eclipse-ocl-bot opened 2 months ago
By Ed Willink on Sep 12, 2012 03:07
Rather than having special collections and lazy boxing, it is easier to take a more rational view of why it is necessary to use boxed values.
Boxing is needed wherever the semantics of Java's Object.equals differ from OCL's OclAny::=. The boxing value provides the OCL semantics in the java world.
Therefore
Objects do not need to be boxed
but meta-model objects do, since there may be multiple representtaions
e.g. Pivot/Ecore so all Types and EnumerationLiterals are boxed.
Integer/Real must be boxed to get correct equality
Boolean/String should not need boxing
Collections benefit from an outer polymorphic layer.
| --- | --- | | Bugzilla Link | 389120 | | Status | NEW | | Importance | P3 normal | | Reported | Sep 09, 2012 07:00 EDT | | Modified | Sep 12, 2012 03:07 EDT | | Reporter | Ed Willink |
Description
Collection values currently contains a Value per element.
This is costly for objects\ a) an ObjectValue per element is created\ b) an additional collection (e.g. a Set) is populated
The polymorphic benefits are rarely enough to compensate since collections are often used for size, object identity, object navigation all of which either only need an object count or unbox again to navigate.