OCL 2.1 RTF Avatar
  1. OMG Issue

OCL21 — The notation for selecting elements should be more intuitive

  • Key: OCL21-208
  • Legacy Issue Number: 6880
  • Status: closed  
  • Source: France Telecom R&D ( Mariano Belaunde)
  • Summary:

    Suggestion: Use brackets as an alternate option to denote a call to the "select"
    function. Notation: mylist[iterator | condition]
    Example:
    self.ownedElementClass and name="MyClass"
    – #Class is a shorthand for oclIsKindOf(MyClass)
    equivalent to :
    self.ownedElement->select(oclIsKindOf(Class) and name="MyClass")

  • Reported: OCL 2.0b2 — Wed, 7 Jan 2004 05:00 GMT
  • Disposition: Resolved — OCL 2.1
  • Disposition Summary:

    The suggested syntax comes from QVTo.
    Non-trivial OCL expressions can be difficult to read. Introducing shorthand notations compromises readability. At present OCL has "." and "->" shorthands that cause significant difficulties. Introducing more does not seem appropriate for the standard language.
    It is not clear that introduction of another [..] syntax can avoid conflicts with the already challenging conflicts for association qualifiers and array indexes.
    Disposition: Closed, no change

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