Eclipse Community Forums - RDF feed
https://www.eclipse.org/forums/
Eclipse Community ForumsLET and IN
https://www.eclipse.org/forums/index.php/mv/msg/155580/490136/#msg_490136
Originally posted by: formatzeh.gmx.de
As I commented in another thread I don't get LET expressions working.
For example the following:
let aspectParams: Set(MyMetaModel::Parameter) =
self.parentIf.parentAspect.events->forAll(ev|
ev.parameter->union(aspectParams)
)
in
aspectParams->includes(self.boolParam)
With that expression I want to check if the referenced boolParam is one
of the parameters of the earlier referenced events of a parent class of
the context class. I get the error in the ocl interpreter example
console that aspectParams isn't recognized. Why does it come as the code
completion does work if I use aspectParams. Another question: is the
above expression correct, especially the generation of the aspectParams
with the recursive union operation?]]>2009-10-07T13:06:52-00:00Re: LET and IN
https://www.eclipse.org/forums/index.php/mv/msg/155580/490319/#msg_490319
The error is correct.
You cannot reference aspectParams as the union argument while
initializing it.
Regards
Ed Willink
Gilbert Mirenque wrote:
> As I commented in another thread I don't get LET expressions working.
> For example the following:
>
> let aspectParams: Set(MyMetaModel::Parameter) =
> self.parentIf.parentAspect.events->forAll(ev|
> ev.parameter->union(aspectParams)
> )
> in
> aspectParams->includes(self.boolParam)
>
> With that expression I want to check if the referenced boolParam is one
> of the parameters of the earlier referenced events of a parent class of
> the context class. I get the error in the ocl interpreter example
> console that aspectParams isn't recognized. Why does it come as the code
> completion does work if I use aspectParams. Another question: is the
> above expression correct, especially the generation of the aspectParams
> with the recursive union operation?]]>Ed Willink2009-10-08T10:48:21-00:00Re: LET and IN
https://www.eclipse.org/forums/index.php/mv/msg/155580/490377/#msg_490377
Originally posted by: formatzeh.gmx.de
Hi Ed,
> You cannot reference aspectParams as the union argument while
> initializing it.
>
Makes sense. I thought the error comes from the latter code. Can you
help me with getting a correct initialization of the aspectParams?]]>2009-10-08T13:51:31-00:00Re: LET and IN
https://www.eclipse.org/forums/index.php/mv/msg/155580/490486/#msg_490486
I'm not sure what you're trying to do but if you want an updating
accumulator, you probably want to use iterate.
Ed
Gilbert Mirenque wrote:
> Hi Ed,
>
>> You cannot reference aspectParams as the union argument while
>> initializing it.
>>
> Makes sense. I thought the error comes from the latter code. Can you
> help me with getting a correct initialization of the aspectParams?]]>Ed Willink2009-10-08T19:44:23-00:00Re: LET and IN
https://www.eclipse.org/forums/index.php/mv/msg/155580/490517/#msg_490517
Originally posted by: formatzeh.gmx.de
But how can I add elements to the Set without using the Set?]]>2009-10-08T22:06:42-00:00Re: LET and IN
https://www.eclipse.org/forums/index.php/mv/msg/155580/490622/#msg_490622
Content-Type: text/plain
Content-Transfer-Encoding: 7bit
Hi, Gilbert,
Try something like this:
let aspectParams: Set(MyMetaModel::Parameter) =
self.parentIf.parentAspect.events.parameter->asSet()
in
aspectParams->includes(self.boolParam)
All you need is a collect iterator, which is implicit in the dot
navigation.
HTH,
Christian
On Fri, 2009-10-09 at 00:06 +0200, Gilbert Mirenque wrote:
> But how can I add elements to the Set without using the Set?
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 TRANSITIONAL//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; CHARSET=UTF-8">
<META NAME="GENERATOR" CONTENT="GtkHTML/3.24.1.1">
</HEAD>
<BODY>
Hi, Gilbert,<BR>
<BR>
Try something like this:<BR>
<BR>
<TT> </TT><TT><FONT COLOR="#000000">let aspectParams: Set(MyMetaModel::Parameter) =</FONT></TT><BR>
<TT><FONT COLOR="#000000"> self.parentIf.parentAspect.events.parameter-></FONT> </TT><TT>asSet()</TT><BR>
<TT> </TT><TT><FONT COLOR="#000000">in</FONT></TT><BR>
<TT> </TT><TT><FONT COLOR="#000000">aspectParams->includes(self.boolParam) </FONT></TT><BR>
<BR>
All you need is a collect iterator, which is implicit in the dot navigation.<BR>
<BR>
HTH,<BR>
<BR>
Christian<BR>
<BR>
<BR>
On Fri, 2009-10-09 at 00:06 +0200, Gilbert Mirenque wrote:
<BLOCKQUOTE TYPE=CITE>
<PRE>
But how can I add elements to the Set without using the Set?
</PRE>
</BLOCKQUOTE>
</BODY>
</HTML>
--=-ovMenT8G8bPR0qVDeOPU--]]>Christian Damus2009-10-09T12:54:58-00:00Re: LET and IN
https://www.eclipse.org/forums/index.php/mv/msg/155580/490964/#msg_490964
Originally posted by: formatzeh.gmx.de
> All you need is a collect iterator, which is implicit in the dot
> navigation.
Ah Ok, thank you very much]]>2009-10-12T15:41:58-00:00