MOF 2.4 RTF Avatar
  1. OMG Issue

MOF24 — Primitive type values cannot be tested for equality using Reflection

  • Key: MOF24-69
  • Legacy Issue Number: 15442
  • Status: closed  
  • Source: gmail.com ( Dmitry Semikin)
  • Summary:

    Reflection package of the MOF defines operation

    MOF::Element.equals(element:Object):Boolean

    for testing equality of model elements. Description of this function (on page 16) tells, that "For instances of DataType, returns true if the object has the same value as this Element instance."

    But instances of particular DataTypes (e.g. Integer, Bolean etc.) are just values (actually, I did not found, where exactly in MOF or UML Infrastructure specification, but somewhere I saw a definition of PrimitiveTypes like "instances of primitive types are identified only by their values"). So they are not Element-s (as I understand, they are Object-s, so each of primitive type, i.e. Integer, Boolean, String, UnlimitedNatural, can be considered as derived from Object, although they are not defined in such a way in MOF specification).

    As so, instances of primitive type has no operation "equals" (which is quite OK, as they should have no operations - for this reasons they are PrimitiveTypes). So we cannot call "equals" operation as member of e.g. Integer Object. So, we cannot compare two integer objects.

    Being more specific, let's cosider example (it is invalid call...):

    some_property.get(lower).equals(MOF::Factory.CreateFromString(integer, "1"))

    this test for equality (if lower bound of "some_property" equals to 1) is invalid, as "get" operation returns just number (value, instance of Integer), and it has not operation "equals".

    Note: in example above "some_property" is instance of MOF::Property, which represents some property of some class, and "lower" is either instance of MOF::Property, which represents lower bound of "some_proerty". "integer" is an instance of MOF::PrimitiveType meta-metaclass, which represents MOF::Integer meta-primitive-type.

    Actually, currently I have no Proposal for solution of this inconsistency, so this message is just report about it.

  • Reported: MOF 2.0 — Fri, 3 Sep 2010 04:00 GMT
  • Disposition: Resolved — MOF 2.4
  • Disposition Summary:

    closed no change

  • Updated: Mon, 20 Apr 2015 17:34 GMT