OCL 2.1 RTF Avatar
  1. OMG Issue

OCL21 — There is no simple way to invoke an "if then else" on a collection

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

    Suggestion: Define an "alt" collection function, with a specific notation, as in:
    mylist->alt(iterator | condition? thenExp, elseExp)
    The expression elseExp is not evaluated if condition returns true

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

    It is not true that there is no way:
    mylist->collect(iterator | if condition then thenExp else elseExp endif)
    which has two more tokens than the suggestion but avoids introducing a "?" syntax irregularity.
    Disposition: Closed, no change

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