UML 1.4 NO IDEA Avatar
  1. OMG Issue

UML14 — OCL: class operation has no 'self'

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

    There is no 'self' object in preconditions and postconditions
    of class operations. For example the following:

    context X::increaseInstanceCounter()
    post: instanceCounter = instanceCounter@pre+1

    will not work, because "instanceCounter" is only a
    syntactic shortcut for the full form
    "self.instanceCounter", and, as already said, there is no
    valid self in this context.

    We can even allow a little syntactic trick along the lines of OCL
    case-sensitivity: when a class name is on the other end of an
    association, making its 1st letter lowercase actually denotes
    associated instance(s) of this class. Going the other way round, we
    may state that when self is written in a capitalized form Self, it
    actually denotes the context class, not object:

    context X::increaseInstanceCounter()
    Self.instanceCounter =

    This point clearly merits a discussion. The good thing is: even if
    the provisions for static class members are included in the OCL
    exactly as suggested above, all existing OCL code will remain

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


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