ADA 1.3 RTF Avatar
  1. OMG Issue

ADA13 — Concern about the mapping of valuetypes to Ada

  • Key: ADA13-17
  • Legacy Issue Number: 5768
  • Status: closed  
  • Source: Airbus Group ( Mr. Oliver M. Kellogg)
  • Summary:

    The IDL to Ada mapping version 1.2 (01-10-42) of valuetypes
    causes serious problems when combined with other IDL constructs.

    Here is an example:

    // file: my_module.idl
    module my_module {

    valuetype vtype

    { public short member; }

    ;

    typedef vtype array_of_vtype[10];

    /* Further sources of problems:
    *
    struct struct_with_vtype

    { vtype smember; }

    ;

    union union_with_vtype switch (boolean)

    { case true: vtype umember; }

    ;
    */

    };

    The array_of_vtype cannot be mapped to Ada, neither can the
    struct_with_vtype or union_with_vtype.

    I propose a change to the mapping for valuetypes as follows:

    " A valuetype shall be mapped to a package, or a nested package
    when the valuetype is declared within a module. "

    For clarity, here is the mapping that I propose for the above
    example:

    – file: my_module.ads
    with CORBA.Value;

    package my_module is

    package vtype is

    type Value_Ref is new CORBA.Value.Base with null record;

    Null_Value : constant Value_Ref;

    procedure Set_member
    (Self : in Value_Ref;
    To : in CORBA.Short);

    function Get_member
    (Self : in Value_Ref)
    return CORBA.Short;

    private
    – elided
    end vtype;

    type array_of_vtype is array (0 .. 9) of vtype.Value_Ref;

    end my_module;

    The change of mapping also affects the naming rules for the
    generated Value_Impl package because in Ada, it is not possible
    to formulate child packages of nested packages.
    I propose the following naming scheme for the Value_Impl
    package:

    The name of the Value_Impl package be formed from the name
    of the value type mapped package with "_Value_Impl" appended.

    Thus, the name of the Value_Impl package for the above example
    would be: my_module.vtype_Value_Impl.

  • Reported: ADA 1.2 — Wed, 27 Nov 2002 05:00 GMT
  • Disposition: Closed; No Change — ADA 1.3
  • Disposition Summary:

    We understand the intent of this and agree that this is a problem. However, it is a
    problem that is also present with the mapping of interface, e.g., we cannot map
    the following IDL:
    interface foo { };
    typedef sequence<foo> fooSeq; with child packages. In actuality, the IDL compiler has to generate a "forward
    reference" and then define a sequence of the forward reference as fooSeq.
    This "flaw" in the mapping was recognized in the initial mapping effort and was
    the subject of pretty extensive debate. The child package mapping of interface
    had several other advantages: the ability to map the implementation package to
    child packages of the interface, and the ability to use them along with forward
    references to map the circular dependencies of interface (see the infamous
    Chicken and Egg example.)
    This flaw has been a problem in only a couple of cases over the 12+ years of the
    current mapping (unfortunately the IR was one of them).
    Thus, we are reluctant to make the change suggested by this issue. Granted it is
    for valuetypes, not IDL interfaces, but consistency is important.
    Disposition: Closed, No Change

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