OCL 2.1 RTF Avatar
  1. OMG Issue

OCL21 — Allow implicit type casting to boolean when a boolean is expected

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

    Example1: if list.select(...) then … equivalent to
    if list.select(...)->notEmpty() then …
    Example2: if item then … equivalent to
    if item<>OCLUndefined then ...

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

    The suggestion introduces a confusion for Boolean variables that may be null. For these variables <> null is required while for non-Boolean variables it can be omitted.
    This seems to be a significant degradation in type safety. Not even Java permits this freedom.
    Disposition: Closed, no change

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