Issue 3911: Incomplete union mapping (java-rtf) Source: Triodia Technologies Pty Ltd (Mr. Michi Henning, michi(at)triodia.com) Nature: Uncategorized Issue Severity: Summary: it appears that the Java mapping for unions is incomplete. For example: enum E { A, B, C }; union U switch (E) { case A: long l; }; Something like this is actually used in the trader specification. For a discriminator value of B or C, the union contains no member (but does contain the discriminator value, of course). The problem arises because the semantics of an operation can differ depending on the discriminator value. For example: interface foo { SomeType op(in U param); }; op() can do different things (and indeed, *does* do different things in the trader spec), depending on whether the discriminator value for the union is B or C. The problem is that the Java mapping does not offer a modifier for the discriminator, thereby making it impossible to control the discriminator value if more than one discriminator value is possible for the same union member. Resolution: withdrawn by submitter Revised Text: Actions taken: September 28, 2000: received issue September 28, 2000: closed issue Discussion: End of Annotations:===== Date: Thu, 28 Sep 2000 09:20:09 +1000 (EST) From: Michi Henning Reply-To: java-rtf@omg.org To: java-rtf@omg.org cc: issues@omg.org Subject: Incomplete union mapping Message-ID: Organization: Object Oriented Concepts MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-UIDL: ]@V!!mD&"!>9h!!H,He9 Hi, it appears that the Java mapping for unions is incomplete. For example: enum E { A, B, C }; union U switch (E) { case A: long l; }; Something like this is actually used in the trader specification. For a discriminator value of B or C, the union contains no member (but does contain the discriminator value, of course). The problem arises because the semantics of an operation can differ depending on the discriminator value. For example: interface foo { SomeType op(in U param); }; op() can do different things (and indeed, *does* do different things in the trader spec), depending on whether the discriminator value for the union is B or C. The problem is that the Java mapping does not offer a modifier for the discriminator, thereby making it impossible to control the discriminator value if more than one discriminator value is possible for the same union member. Cheers, Michi. -- Michi Henning +61 7 3891 5744 Object Oriented Concepts +61 4 1118 2700 (mobile) Suite 4, 904 Stanley St +61 7 3891 5009 (fax) East Brisbane 4169 michi@ooc.com.au AUSTRALIA http://www.ooc.com.au/staff/michi-henning.html X-Sender: mark@192.168.1.2 X-Mailer: QUALCOMM Windows Eudora Version 4.3.2 Date: Wed, 27 Sep 2000 17:27:39 -0700 To: java-rtf@omg.org From: Mark Spruiell Subject: Re: Incomplete union mapping In-Reply-To: Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" X-UIDL: 9>;!!5Ud!!/96!!3iXd9 Hi Michi, Actually, the Java mapping already accommodates this. Two overloadings of the __default() method are generated, one taking no argument that sets the discriminator to an unused value, and one taking a discriminator value. - Mark At 09:20 AM 9/28/2000 +1000, you wrote: >Hi, > >it appears that the Java mapping for unions is incomplete. For example: > > enum E { A, B, C }; > > union U switch (E) { > case A: > long l; > }; > >Something like this is actually used in the trader specification. For >a discriminator value of B or C, the union contains no member (but does >contain the discriminator value, of course). The problem arises because >the semantics of an operation can differ depending on the discriminator >value. For example: > > interface foo { > SomeType op(in U param); > }; > >op() can do different things (and indeed, *does* do different things in the >trader spec), depending on whether the discriminator value for the union >is B or C. > >The problem is that the Java mapping does not offer a modifier for >the discriminator, thereby making it impossible to control the discriminator >value if more than one discriminator value is possible for the same union >member. > > Cheers, > > Michi. >-- >Michi Henning +61 7 3891 5744 >Object Oriented Concepts +61 4 1118 2700 (mobile) >Suite 4, 904 Stanley St +61 7 3891 5009 (fax) >East Brisbane 4169 michi@ooc.com.au >AUSTRALIA http://www.ooc.com.au/staff/michi-henning.html Date: Thu, 28 Sep 2000 11:39:49 +1000 (EST) From: Michi Henning To: Mark Spruiell cc: java-rtf@omg.org Subject: Re: Incomplete union mapping In-Reply-To: <4.3.2.7.2.20000927172640.02e97a40@192.168.1.2> Message-ID: Organization: Object Oriented Concepts MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-UIDL: UUfd9Y!!!!SU'e9l,a!! On Wed, 27 Sep 2000, Mark Spruiell wrote: > Hi Michi, > > Actually, the Java mapping already accommodates this. Two > overloadings > of the __default() method are generated, one taking no argument that > sets the discriminator to an unused value, and one taking a > discriminator > value. Yes, you are right. Sorry for the brain-lock on my part :-( Juergen, please don't create an issue for this. Cheers, Michi. Importance: Normal Subject: Re: Incomplete union mapping To: java-rtf@omg.org, michi@oac.com.au X-Mailer: Lotus Notes Release 5.0.3 (Intl) 21 March 2000 Message-ID: From: "Kim Rochat/Austin/IBM" Date: Thu, 28 Sep 2000 10:45:48 -0500 X-MIMETrack: Serialize by Router on D04NM107/04/M/IBM(Release 5.0.3 (Intl)|21 March 2000) at 09/28/2000 11:45:50 AM MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-UIDL: d+!e9+>'e9EMSd9NIgd9 Michi, The case you mention is covered under section 1.9 of 99-07-53.pdf - "Two default modifier methods, both named __default(), are generated if there is no explicit default case label, and the set of case labels does not completely cover the possible values of the discriminant. The simple method taking no arguments and returning void sets the discriminant to the first available default value starting from a 0 index of the discriminant type. The second method takes a discriminator as a parameter and returns void. Both of these of methods shall leave the union with a discriminator value set, and the value member uninitialized." (Note, Jeff M. as also confirmed that "__default" has two underscores before it due to the 1.2 RTF, although no current product spells it that way.) Cheers, Kim Kim Rochat, IBM Websphere Enterprise, Austin, Texas, USA tl 793-, voice 512-823-8792, fax 512-838-1032, krochat@us.ibm.com ____________________________________________________________ Michi Henning on 09/27/2000 06:20:09 PM Please respond to java-rtf@omg.org To: java-rtf@omg.org cc: issues@omg.org Subject: Incomplete union mapping Hi, it appears that the Java mapping for unions is incomplete. For example: enum E { A, B, C }; union U switch (E) { case A: long l; }; Something like this is actually used in the trader specification. For a discriminator value of B or C, the union contains no member (but does contain the discriminator value, of course). The problem arises because the semantics of an operation can differ depending on the discriminator value. For example: interface foo { SomeType op(in U param); }; op() can do different things (and indeed, *does* do different things in the trader spec), depending on whether the discriminator value for the union is B or C. The problem is that the Java mapping does not offer a modifier for the discriminator, thereby making it impossible to control the discriminator value if more than one discriminator value is possible for the same union member. Cheers, Michi. -- Michi Henning +61 7 3891 5744 Object Oriented Concepts +61 4 1118 2700 (mobile) Suite 4, 904 Stanley St +61 7 3891 5009 (fax) East Brisbane 4169 michi@ooc.com.au AUSTRALIA http://www.ooc.com.au/staff/michi-henning.html Reply-To: From: "Nick Sharman" To: "Kim Rochat/Austin/IBM" , Subject: RE: Incomplete union mapping Date: Fri, 29 Sep 2000 12:05:45 +0100 Message-ID: MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook IMO, Build 9.0.2416 (9.0.2910.0) Importance: Normal X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2314.1300 In-Reply-To: Content-Type: text/plain; charset="iso-8859-1" X-UIDL: 1o-e9W[L!!7,"!!7Zk!! Kim, > (Note, Jeff M. as also confirmed that "__default" has two underscores > before it due to > the 1.2 RTF, although no current product spells it that way.) Our implementation, LiveContent BROKER for Java, does. Regards Nick --------------------------------- Nick Sharman Architect, LiveContent BROKER Critical Path UK Tel: +44 (0) 161 333 4073 UK Fax: +44 (0) 161 333 4001 E-mail: mailto:nick.sharman@cp.net Web: http://www.cp.net