Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » QVT-OML » helper with side effect in QVT - OML(helper with side effect in QVT - OML)
helper with side effect in QVT - OML [message #1267828] Sun, 09 March 2014 16:59 Go to next message
Ben Haldo is currently offline Ben HaldoFriend
Messages: 6
Registered: October 2013
Junior Member
According to QVT - operational specification, a helper with side effect can be declared as:

helper computeCandidates(inout studentList:Sequence(String)) : Sequence(String) {
var newStudent:String := "a new Student";
studentList += newStudent;
return studentList;
}

But in eclipse QVTO transformation project, This crates an error stating:

"Can't assign a value to 'inout' parameter 'studentList'"

Any ideas on how to fix this?



Re: helper with side effect in QVT - OML [message #1267878 is a reply to message #1267828] Sun, 09 March 2014 18:39 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7655
Registered: July 2009
Senior Member
Hi

Use a mutable Collection; ie. List.

Regards

Ed Willink

On 09/03/2014 16:59, Ben Haldo wrote:
> According to QVT - operational specification, a helper with side
> effect can be declared as:
>
> helper computeCandidates(inout studentList:Sequence(String)) :
> Sequence(String) {
> var newStudent:String := "a new Student";
> studentList += newStudent;
> return studentList;
> }
>
> But in eclipse QVTO transformation project, This crates an error stating:
>
> "Can't assign a value to 'inout' parameter 'studentList'"
>
> Any ideas on how to fix this?
>
>
>
>
Re: helper with side effect in QVT - OML [message #1269788 is a reply to message #1267828] Wed, 12 March 2014 07:38 Go to previous message
Sergey Boyko is currently offline Sergey BoykoFriend
Messages: 171
Registered: July 2009
Senior Member
Hi Ben,

Ben Haldo wrote on Sun, 09 March 2014 12:59
According to QVT - operational specification, a helper with side effect can be declared as:

helper computeCandidates(inout studentList:Sequence(String)) : Sequence(String) {
var newStudent:String := "a new Student";
studentList += newStudent;
return studentList;
}

But in eclipse QVTO transformation project, This crates an error stating:

"Can't assign a value to 'inout' parameter 'studentList'"

Any ideas on how to fix this?





This is certainly valid script.
You must switch to the recent QVTo version (most reasonable is to use 3.4.0 M6 http://www.eclipse.org/mmt/downloads/index.php?project=qvto&showAll=0&showMax=5).
Then helper will be compiled and executed without errors.

main() {
  var list = Sequence{};
  var list2 = computeCandidates(list);
  assert (list2 = Sequence{"a new Student"});
  ...



Regards,
Sergey.
Previous Topic:Running qvto Transformations with in/out Metamodels registered by Metamodel-Plugins
Next Topic:Adding qvto editor in RCP application
Goto Forum:
  


Current Time: Tue Mar 19 06:28:39 GMT 2024

Powered by FUDForum. Page generated in 0.03343 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top