Issue 5768: Concern about the mapping of valuetypes to Ada (ada-rtf) Source: Airbus Group (Mr. Oliver M. Kellogg, oliver.kellogg(at)airbus.com) Nature: Uncategorized Issue Severity: 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. Resolution: 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 Revised Text: Actions taken: November 27, 2002: received issue January 12, 2010: closed issue; Closed; No Change Discussion: End of Annotations:===== Sender: oliver.kellogg@sysde.eads.net Date: Wed, 27 Nov 2002 10:29:07 +0100 From: Oliver Kellogg Organization: EADS Deutschland GmbH X-Mailer: Mozilla 4.76 [en] (X11; U; Linux 2.4.18-17.7.x i686) X-Accept-Language: en To: issues@omg.org Subject: Concern about the mapping of valuetypes to Ada 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. -- Oliver M. Kellogg Naval and Ground Operations (NGO2) Systems and Defence Electronics EADS Deutschland GmbH D-89070 Ulm, Germany e-mail: oliver.kellogg@sysde.eads.net tel.: (+49) 731 392-7138 fax: (+49) 731 392-5826 From: Victor Giddings To: Oliver Kellogg Subject: Issue 5768 Date: Sat, 25 Oct 2008 11:12:19 -0400 Cc: ada-rtf@omg.org X-Mailer: Apple Mail (2.929.2) Oliver, I 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 IDL: interface foo { }; typedef sequenc 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, I am reluctant to make the change suggested by this issue. Granted it is for valuetypes, not IDL interfaces, but I think consistency is important. Of course, if we were to do a mapping for Ada 2005, I believe the use of Ada interfaces would make these issues disappear. Victor Giddings Objective Interface Systems victor.giddings@mail.ois.com From: Victor Giddings To: ada-rtf@omg.org Subject: Proposed Resolution for 5768 Date: Sun, 1 Feb 2009 12:25:32 -0500 X-Mailer: Apple Mail (2.930.3) Disposition: Closed No Change OMG Issue No: 5768 Title: Concern about the mapping of valuetypes to Ada Source: Daimler AG Mr. Oliver M. Kellogg, oliver.kellogg@eads.com Oliver.Kellogg@t-online.de 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. Discussion: 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 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