Issue 4503: Default-initialization for structs/unions/arrays/user exceptions/valuetypes (idlscript-ftf) Source: INRIA (Dr. Philippe Merle, merle@lifl.fr) Nature: Uncategorized Issue Severity: Summary: In the CORBA Scripting Language Specification v1.0 (OMG TC Document formal/01-06-05), creating a struct, union, array, user exception or valuetype required to provide a value for each field. e.g. Section 3.6.3 "Structure Values" page 3-8: "The creation of an IDL structure value is achieved by the calling notation (IDLType(field1,...,fieldn)). The interpreter checks if the number of given values is equal to the number of the expected IDL fields..." Ditto in sections 3.7.3 page 3-9, 3.10.3 page 3-15, 3.11.6 page 3-20, and 3.14.3 page 3-30. For complex structs, unions, arrays, user exceptions and valuetypes, Chris Oliver (coliver@mminternet.com) think it would be much more user-friendly to always allow the "constructor" to be optionally called with zero arguments which would result in default-initialization of the complex value. The user can then incrementally fill out the contents of complex values, for example: nc = CosNaming.NameComponent() nc.id = "a" nc.kind = "b" Since DynamicAny::DynAny in CORBA 2.3 provides default-initialization, this requires no extra effort for the implementor. ------------------------------------------------------------------------- Resolution: see above Revised Text: Following changes must be applied to the formal/01-06-05 document. At page 3-8, section 3.6.3, replace The interpreter checks . . . by If no argument is provided, all the struct fields are (recursively) initialized to their default values. If arguments are provided, the interpreter checks . . At page 3-8, section 3.6.3, add following examples >>> p0 = Point() >>> p0 Point(0,0) >>> tp0 = TwoPoints() >>> tp0 TwoPoints(Point(0,0),Point(0,0)) At page 3-10, section 3.7.3, replace The interpreter checks . . . by If no argument is not provided, the union discriminator is set to a value consistent with the first named member of the union and the associated union member is (recursively) initialized to its default value. If only the discriminator is provided, the associated union member is (recursively) initialized to its default value. If both values are provided, the interpreter checks . . . At page 3-10, section 3.7.3, add following examples >>> AnUnion() AnUnion(0,0) >>> AnUnion(1) AnUnion(1,0) At page 3-15, section 3.10.3, replace The type of each value . . . by If no value is provided, all the array items are (recursively) initialized to their default values. If values are provided, the type of each value . . . At page 3-15, section 3.10.3, add following examples >>> a = ArrayLong() >>> a ArrayLong(0,0,0,0,0,0,0,0,0,0) >>> a = ArrayPoint() >>> a ArrayPoint(Point(0,0),Point(0,0),Point(0,0),Point(0,0), Point(0,0),Point(0,0),Point(0,0),Point(0,0),Point(0,0), Point(0,0)) At page 3-20, section 3.11.6, replace The interpreter checks . . . by If no argument is provided, all the user exception fields are (recursively) initialized to their default values. If arguments are provided, the interpreter checks . . . At page 3-20, section 3.11.6, add the following example >>> u = Exception() >>> u Exception("",Months.January,Point(0,0)) Actions taken: August 16, 2001: received issue December 11, 2002: closed issue Discussion: In order to simplify the creation of complex structs, unions, arrays, and user exceptions, the initialization notation of these types can accept zero argument. Then the fields of the created objects are initialized to their default values. For value types, no change is required as they are created by calling value factory operations End of Annotations:===== From: Philippe.Merle@lifl.fr Received: from (merle@localhost) by karjala.lifl.fr (8.9.1b+Sun/jtpda-5.3.3) id RAA23060 ; Thu, 16 Aug 2001 17:50:11 +0200 (MET DST) Date: Thu, 16 Aug 2001 17:50:11 +0200 (MET DST) Message-Id: <200108161550.RAA23060@karjala.lifl.fr> To: issues@omg.org Subject: Issues for the CORBA Scripting Language Specification Cc: juergen@omg.org, idlscript-ftf@omg.org X-Sun-Charset: US-ASCII Content-Type: text X-UIDL: jNl!!:lO!!,e*e9:QF!! Hello Juergen, I am knowing that the Public Comment Deadline for IDLscript is out but I have collected from my archives four issues that should be resolved in the next IDLscript RTF. Thank you to report me assigned issue numbers allowing me to write the final IDLscript RTF report (for tomorrow). - Issue 4 ------------------------------------------------------------------------ Default-initialization for structs, unions, arrays, user exceptions and valuetypes ---------------------------------------------------------------------------------- In the CORBA Scripting Language Specification v1.0 (OMG TC Document formal/01-06-05), creating a struct, union, array, user exception or valuetype required to provide a value for each field. e.g. Section 3.6.3 "Structure Values" page 3-8: "The creation of an IDL structure value is achieved by the calling notation (IDLType(field1,...,fieldn)). The interpreter checks if the number of given values is equal to the number of the expected IDL fields..." Ditto in sections 3.7.3 page 3-9, 3.10.3 page 3-15, 3.11.6 page 3-20, and 3.14.3 page 3-30. For complex structs, unions, arrays, user exceptions and valuetypes, Chris Oliver (coliver@mminternet.com) think it would be much more user-friendly to always allow the "constructor" to be optionally called with zero arguments which would result in default-initialization of the complex value. The user can then incrementally fill out the contents of complex values, for example: nc = CosNaming.NameComponent() nc.id = "a" nc.kind = "b" Since DynamicAny::DynAny in CORBA 2.3 provides default-initialization, this requires no extra effort for the implementor. ------------------------------------------------------------------------- A+ Philippe Merle -- ___________________________________________________________________________ Dr. Philippe Merle - Associate Researcher at INRIA Laboratoire d'Informatique Fondamentale de Lille UPRESA 8022 CNRS - U.F.R. I.E.E.A. - Batiment M3 Universite des Sciences et Technologies de Lille 59655 Villeneuve d'Ascq CEDEX France Tel: (33) (0)3 20 43 47 21 Fax: (33) (0)3 20 43 65 66 E-Mail: Philippe.Merle@lifl.fr Home Page: http://www.lifl.fr/~merle See also: http://corbaweb.lifl.fr/ ___________________________________________________________________________