UML 1.4 NO IDEA Avatar
  1. OMG Issue

UML14 — OCL: Are keywords reserved or not

  • Key: UML14-967
  • Legacy Issue Number: 3138
  • Status: closed  
  • Source: OpenModeling ( Jos Warmer)
  • Summary:

    Although the OCL specifies a respectable set of keywords (like
    "and", "if", etc.) the OCL reference says nothing about whether
    they are reserved or not. Clearly, a software designer is completely
    free to specify the class with an attribute called "if". Or, more
    probably, "context". Or any other OCL keyword. How, then, to
    parse an OCL constraint like:

    context if : X inv:
    if.then->size()>=else->size()

    (where if is used instead of self to designate the object an
    invariant is applied to, and then and else are its associations).

    Clearly, reserving keywords is a bad idea. The rule, which seems
    to work well (and has been tried in many real programming
    languages over decades) is:

    An identifier is recognized as a keyword if and only if it is
    encountered in a context where this keyword can legally
    appear.

  • Reported: UML 1.2 — Fri, 17 Dec 1999 05:00 GMT
  • Disposition: Resolved — UML 1.3
  • Disposition Summary:

    No Data Available

  • Updated: Fri, 6 Mar 2015 21:37 GMT