Issue 12374: MOF QVT 1.0, 8.2.2.22, Unclear specification of Unpack notation shorthand (qvt-rtf) Source: Model Driven Solutions (Dr. Edward Willink, ed(at)willink.me.uk) Nature: Uncategorized Issue Severity: Summary: Section 8.2.2.22 provides no guidance on the meaning of: var x:X; var y:Y; var z:Z; ... var (x:X,y,z) := self.foo(); [If one of the variables in the left hand side, does exist ...] Possible interpretations a) x:X is always a syntactical shorthand. Therefore the above is a shorthand for: var x:X; var y:Y; var z:Z; ... var x:X; var (x,y,z) := self.foo(); and consequently there is duplicate variable definition to be reported as a semantic error. b) x:X is a convenience type check assertion Therefore the above is a shorthand for: var x:X; var y:Y; var z:Z; ... var (x,y,z) := self.foo(); with a successful validation of type consistency. c) x:X is not available as a shorthand Therefore the above is a syntax error. ------------------------------------ Interpretations b) and c) require semantic knowledge to resolve syntactic sugar. Interpretation a) is an unambiguous syntax shorthand that could be more clearly described by: "The following example demonstrates a shorthand in which variables are both declared and assigned. var (x:X,y:Y,z) := self.foo(); Any variable name qualified by a type name is both a declaration and an assignment, with all declarations proceding the unapack assignment. The above example should therefore be analyzed as: var x:X; var y:Y; var (x,y,z) := self.foo();" --------------------------------------------------------------------- Recommend interpretation a) with the above textual clarification. Resolution: Revised Text: (1) Replace the text: """If one of the variables in the left hand side does not exist, the notation is a shorthand for declaring the missing variables prior to the unpack expression. In such case, the type of the variables can be given. For instance, in the example above, if 'x' and 'y' does not exist, the expression var (x:X,y:Y,z) := self.foo(); is equivalent to: var x:X; var y:Y; var (x,y,z) := foo(); """ By the following text: """The following example demonstrates a shorthand in which variables are both declared and assigned. var (x:X,y:Y,z) := self.foo(); Any variable name which specifies a type name is both a declaration and an assignment, with all declarations proceding the unpack assignment. The above example should therefore be analyzed as: var x:X; var y:Y; var (x,y,z) := self.foo();" """ Actions taken: April 8, 2008: received issue April 26, 2010: closed issue Discussion: End of Annotations:===== m: "Willink, Ed" To: "'issues@omg.org'" Cc: 'Adolfo Sánchez-Barbudo Herrera' Subject: MOF QVT 1.0, 8.2.2.22, Unclear specification of Unpack notation s horthand Date: Tue, 8 Apr 2008 11:36:31 +0100 X-Mailer: Internet Mail Service (5.5.2656.59) Section 8.2.2.22 provides no guidance on the meaning of: var x:X; var y:Y; var z:Z; ... var (x:X,y,z) := self.foo(); [If one of the variables in the left hand side, does exist ...] Possible interpretations a) x:X is always a syntactical shorthand. Therefore the above is a shorthand for: var x:X; var y:Y; var z:Z; ... var x:X; var (x,y,z) := self.foo(); and consequently there is duplicate variable definition to be reported as a semantic error. b) x:X is a convenience type check assertion Therefore the above is a shorthand for: var x:X; var y:Y; var z:Z; ... var (x,y,z) := self.foo(); with a successful validation of type consistency. c) x:X is not available as a shorthand Therefore the above is a syntax error. ------------------------------------ Interpretations b) and c) require semantic knowledge to resolve syntactic sugar. Interpretation a) is an unambiguous syntax shorthand that could be more clearly described by: "The following example demonstrates a shorthand in which variables are both declared and assigned. var (x:X,y:Y,z) := self.foo(); Any variable name qualified by a type name is both a declaration and an assignment, with all declarations proceding the unapack assignment. The above example should therefore be analyzed as: var x:X; var y:Y; var (x,y,z) := self.foo();" --------------------------------------------------------------------- Recommend interpretation a) with the above textual clarification. ******************************************************************************* Please consider the environment before printing this email. ******************************************************************************* This email and any files transmitted with it are intended solely for the use of the individual or entity to whom they are addressed and may not be divulged to any third party without the express permission of the originator. Any views expressed in this message are those of the individual sender, except where the sender specifically states them to be the views of Thales Research & Technology (UK) Limited. *******************************************************************************