-
Key: QVT-41
-
Legacy Issue Number: 11060
-
Status: closed
-
Source: France Telecom R&D ( Mariano Belaunde)
-
Summary:
The notation x,y, z = foo() may be difficult to parse. Consider revising it.
For instance using parenthesis: (x,y,z) = foo().
Also consider extending this notation to non anonymous tuples -
Reported: QVT 1.0b1 — Thu, 24 May 2007 04:00 GMT
-
Disposition: Resolved — QVT 1.0
-
Disposition Summary:
1) In Section 8.2.2.22, add a property named 'source' with the following definition:
{composes}
source : OclExpression [1]The source expression to be unpacked. The type of the expression should necessarily be an ordered tuple.
(2) In Section 8.2.2.22, rename the property 'variable' as 'targetVariable'
(3) In Section 8.2.2.22, in the Notation section, replace all the text by the following:
The notation is similar to an assignment expression except that the list of variables is in parenthesis and prefixed by the var keyword.
var (x,y,z) := self.foo(); // assuming 'foo' returns a tuple of three elements
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();
es equivalent to:
var x:X; var y:Y; var (x,y,z) := foo();
(3) Update the diagram 8.6 as given by appendix D -
Updated: Fri, 6 Mar 2015 20:54 GMT