Skip to main content



      Home
Home » Archived » M2M (model-to-model transformation) » i++
i++ [message #535214] Fri, 21 May 2010 11:19 Go to next message
Eclipse UserFriend
hi,

how i can do i++ in ocl ?

thanks
Re: i++ [message #535222 is a reply to message #535214] Fri, 21 May 2010 11:46 Go to previous messageGo to next message
Eclipse UserFriend
On 21/05/2010 16:19, graa wrote:
> hi,
>
> how i can do i++ in ocl ?
>
> thanks
OCL is a side effect free language, so it is impossible.

However if you look at why you want to do i++ there may be a solution.

For instance, one standard idiom that handles loop counters is

Sequence{1..size}->forAll(...)

Regards

Ed Willink
Re: i++ [message #535252 is a reply to message #535214] Fri, 21 May 2010 14:08 Go to previous message
Eclipse UserFriend
hi graa

sylivana has replied to u

Sylvain EVEILLARD wrote on Tue, 18 May 2010 13:23
You can't have braces in OCL because you can't execute multiple operations in an OCL IF. And finally, you can't make assignments in OCL (<-).

For the increase of counter you can use an ATL workaround :
let fakeLet : OclAny = thisModule.refSetValue('counter',thisModule.counter + 1) in





it is not direct way, fake....
Previous Topic:[ATL] Applying stereotypes in refinement mode
Next Topic:.ecore
Goto Forum:
  


Current Time: Fri Jun 20 04:16:50 EDT 2025

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

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

Back to the top