OCL 2.1 RTF Avatar
  1. OMG Issue

OCL21 — The notation for testing the type of a metaclass is too verbose

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

    Suggestion: Use special characters to denote a call to oclIsKindOf and oclIsTypeOf.
    For instance, use '#ActionState' instead of 'oclIsKindOf(ActionState)'
    and use '##ActionState' instead of 'oclIsTypeOf(ActionState)'

  • 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.
    oclIsKindOf and oclIsTypeOf are already a source of confusion; oclIsTypeOf should rarely be used but is the more obvious name to new users, so providing a shorthand for oclIsTypeOf is unnecessary.
    The # syntax has no terminator so the shorthand needs an ambiguity resolution for a.#B.c()
    The suggested usage seems to conflict with the intuition of those familiar with unary prefixes of assembler languages or even OCL 1.x enumeration literals.
    If an improvement is to be made, something like
    (a as B).c()
    would contribute to rather than hamper readibility.
    Disposition: Closed, no change

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