OCL 2.5 RTF Avatar
  1. OMG Issue

OCL25 — OCL 2.3 Introduce a reserved OclSelf template parameter

  • Key: OCL25-122
  • Legacy Issue Number: 16019
  • Status: open  
  • Source: Model Driven Solutions ( Ed Willink)
  • Summary:

    Three library operations do not appear to be declarable without intuitive typing semantics.

    Introduction of an OclSelf template parameter that is the statically determined type of self can solve the problem. OclSelf is a reserved spelling.

    Classifier::allInstances(OclSelf)() : Set(OclSelf) – set of the derived classifier
    OclAny::oclType(OclSelf)() : OclSelf – my own type as statically known
    OclAny::oclAsSet(OclSelf)() : Set(OclSelf) – set of my own and derived types, declared as the statically known type

    [oclAsSet is the currently unspecified library operation used to realise implicit object-to-set conversion]

    Without an OclSelf, almost any usage of these library operations must be followed by an oclAsType to the already known type.

    e.g. with the OCL 2.3 type system the library function is

    Classifier::allInstances() : Set(Classifier)

    and so the usage is

    MyType.allInstances() – is MyType instances as a Set(Classifier)
    MyType.allInstances().oclAsType(Set(MyType)) – necessary cast to statically known type

  • Reported: OCL 2.1 — Sat, 12 Feb 2011 05:00 GMT
  • Updated: Thu, 8 Oct 2015 14:12 GMT