Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » M2T (model-to-text transformation) » [Acceleo] Using tuples(How to define tuples using let?)
[Acceleo] Using tuples [message #660955] Tue, 22 March 2011 09:48 Go to next message
Liviu  is currently offline Liviu
Messages: 1
Registered: March 2011
Junior Member
Hello,

I'm trying to declare Tuples, using let, like this:

[template ttt5()]
[let x : Tuple(a:Integer,b:Integer) = Tuple {a=1,b=2}]
[x.b/]
[/let]
[/template]

For this example I have a syntax error, "Invalid Type Tuple(a:Integer, b:Integer).".

If, instead I try like this, with an OCL query,

[query qqq5() : Integer =
let x : Tuple(a:Integer,b:Integer) = Tuple {a=1,b=2} in
x.b
/]

the output is as expected. Also I didn't manage to define a query returning a Tuple, and the iterate over the result of that query, for example with a for block.
Can someone explain this, and maybe give some correct examples of tuples usage?

Thanks alot,
Liviu


Re: [Acceleo] Using tuples [message #661121 is a reply to message #660955] Wed, 23 March 2011 05:32 Go to previous message
Stephane Begaudeau is currently offline Stephane Begaudeau
Messages: 406
Registered: April 2010
Location: Nantes (France)
Senior Member

Hi Liviu,

I try to see where the problem is coming from and since I haven't found it, I have opened a bug in order to track this problem: https://bugs.eclipse.org/bugs/show_bug.cgi?id=340735
In the mean time, since Tuple seems to work in queries, I would recommend manipulating them only within queries.


Stephane Begaudeau Obeo,

--
Twitter: @sbegaudeau
Acceleo wiki: http://wiki.eclipse.org/Acceleo
Blogs: http://stephanebegaudeau.tumblr.com & http://sbegaudeau.tumblr.com



Previous Topic:[Acceleo] white lines into code and code move
Next Topic:Check Assoziation in Xtend
Goto Forum:
  


Current Time: Sat Aug 02 04:47:03 EDT 2014

Powered by FUDForum. Page generated in 0.01944 seconds