QVT 1.3 RTF Avatar
  1. OMG Issue

QVT13 — QVTo: Standard Library return types

  • Key: QVT13-12
  • Legacy Issue Number: 13181
  • Status: closed  
  • Source: Open Canarias, SL ( Adolfo Sanchez-Barbudo Herrera [X] (Inactive))
  • Summary:
      • QVTo Standard Library. Some operation's returned values would better return the TemplateParameterType **
        Several stdlib operations would be better changed to avoid doing unnecessary castings on the returned value of the operation.

    For AnyType::oclAsType(oclType) operation I could write:

    var aClass : Class := anotherVar.oclAsType(Class);

    However, for Model::objectsOfType(OclType) operation I can't do:

    var aClassSet : Set(Class) := aModel.objectsOfType(Class);

    I have to do the following, instead:

    var aClassSet : Set(Class) := aModel.objectsOfType(Class).oclAsType(Set(Class));

    Therefore, for end-user usability, I propose exploiting TemplateParameterType and changing some QVTo Standard Library operations

    Element::subobjectsOfType(OclType) : Set(T)
    Element::allSubobjects(OclType) : Set(T)
    Element::subobjectsOfKind(OclType) : Set(T)
    Element::allSubobjectsOfKind(OclType) : Set(T)
    Element::clone() : T
    Element::deepclone() : T
    Model::objectsOfType(OclType) : Set(T)
    Model::copy() : T
    Model::createEmptyModel(): T

    Note: this approach is made in the Object::asOrderedTuple() : OrderedTuple(T) operation.

  • Reported: QVT 1.0 — Fri, 19 Dec 2008 05:00 GMT
  • Disposition: Duplicate or Merged — QVT 1.3
  • Disposition Summary:

    8.3.5.7 createEmptyModel static Model::createEmptyModel() : Model Creates and initializes a model of the given type. This operation is useful when creating intermediate models within a transformation.

    QVTo Standard Library. Some operation's returned values would better return the TemplateParameterType **
    Several stdlib operations would be better changed to avoid doing unnecessary castings on the returned value of the operation.

    For AnyType::oclAsType(oclType) operation I could write:

    var aClass : Class := anotherVar.oclAsType(Class);

    However, for Model::objectsOfType(OclType) operation I can't do:

    var aClassSet : Set(Class) := aModel.objectsOfType(Class);

    I have to do the following, instead:

    var aClassSet : Set(Class) := aModel.objectsOfType(Class).oclAsType(Set(Class));

    Therefore, for end-user usability, I propose exploiting TemplateParameterType and changing some QVTo Standard Library operations

    Element::subobjectsOfType(OclType) : Set(T)
    Element::allSubobjects(OclType) : Set(T)
    Element::subobjectsOfKind(OclType) : Set(T)
    Element::allSubobjectsOfKind(OclType) : Set(T)
    Element::clone() : T
    Element::deepclone() : T
    Model::objectsOfType(OclType) : Set(T)
    Model::copy() : T
    Model::createEmptyModel(): T

    Note: this approach is made in the Object::asOrderedTuple() : OrderedTuple(T) operation.

    Discussion

    subobjectsOfType etc duplicate QVT13-53

    clone/deepclone merged into QVT13-53

    Model::copy/createEmptyModel - NO. Model is the correct return type.

  • Updated: Tue, 29 Mar 2016 15:09 GMT