QVT 1.0 NO IDEA Avatar
  1. OMG Issue

QVT — Clarify the return type of xselect operator

  • Key: QVT-12
  • Legacy Issue Number: 10926
  • Status: closed  
  • Source: France Telecom R&D ( Mariano Belaunde)
  • Summary:

    Various examples provided in the spec suggest that the return type of xselect operator
    (bracket notation) depends on the filter expression (implicit casting).
    However this is currently not explained in the definition of the operator.

  • Reported: QVT 1.0b1 — Tue, 17 Apr 2007 04:00 GMT
  • Disposition: Resolved — QVT 1.0
  • Disposition Summary:

    (1) In section 8.2.2.7 ImperativeIterateExp add the following sentence at the end of the 2nd paragraph: "Also a specific implicit type casting rule applies depending on the condition expression that is associated with the iteration (see implicit type casting rules sub-section)."
    (2) Before the Semantics sub-section, add a sub-section named "Type re-casting" with the following text:
    """The type of the sequence or the object returned by the ImperativeIterateExp construct depends on the usage of the 'condition' expression is used: if the condition is an instance of TypeExp, the condition is firstly re-interpreted as a Boolean expression of the form 'oclIsKind(TypeExp)'. Additionally, the returned sequence (resp. the returned single object) is re-casted as a sequence of the type denoted in the type expression (resp. as an instance of the denoted type). If the 'condition' expression is not used or is not a TypeExp instance no implicit re-casting semantic applies.
    Example:
    self.mysequence[MyType]
    // the type of this expression is a Sequence of 'MyList'
    self.mysequence[oclIsKind(MyType) and name=="foo"]
    // the type is the type of the self.mysequence source expression
    """
    NOTE: There is a typo in the resolution text within item (2): the sentence
    "// the type of this expression is a Sequence of 'MyList'" should be
    "// the type of this expression is a Sequence of 'MyType'"

  • Updated: Fri, 6 Mar 2015 20:54 GMT