UML 2.6 RTF Avatar
  1. OMG Issue

UMLR — Template Binding Question

  • Key: UMLR-171
  • Legacy Issue Number: 13926
  • Status: open  
  • Source: NASA ( Dr. Maged Elaasar)
  • Summary:

    In the spec, there is a constraint on TemplateParameterSubstitution, as follows:

    actual->forAll(a | a.isCompatibleWith(formal.parameteredElement))

    "actual" and "formal" are TemplatableElement. So looking up "isCompatibleWith" definition in the spec, I find this:

    The query isCompatibleWith() determines if this parameterable element is compatible with the specified parameterable element. By default parameterable element P is compatible with parameterable element Q if the kind of P is the same or a subtype as the kind of Q. Subclasses should override this operation to specify different compatibility constraints.

    ParameterableElement::isCompatibleWith(p : ParameterableElement) : Boolean;
    isCompatibleWith = p->oclIsKindOf(self.oclType)

    This means if I defined a class template with a template parameter linked to Interface A (a ParametrableElement), and I used this interface to type a property inside the class template, that I cannot substite the interface with Class B that realizes Interface A, because Class B and Interface A do not have compatible kinds (metaclasses).

    Is this what the constraint is saying? Is this Valid?

  • Reported: UML 2.5 — Wed, 29 Apr 2009 04:00 GMT
  • Updated: Fri, 6 Mar 2015 20:57 GMT