Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » OCL » oclAsType in xtext console
oclAsType in xtext console [message #1314662] Fri, 25 April 2014 14:16 Go to next message
Klaas Gadeyne is currently offline Klaas GadeyneFriend
Messages: 94
Registered: July 2009
Member
Hi,

latest nightly build gives me this result in the xtext ocl console

Evaluating:
1.oclType()
Results:
UnlimitedNatural

Evaluating:
1.oclAsType(Real).oclType()
Results:
UnlimitedNatural


I was expecting that the second expression would return Real?
Re: oclAsType in xtext console [message #1314700 is a reply to message #1314662] Fri, 25 April 2014 14:46 Go to previous message
Ed Willink is currently offline Ed WillinkFriend
Messages: 4187
Registered: July 2009
Senior Member
Hi

No. oclAsType() returns either the source object or invalid. It just
changes the static type.

You'll see the same in Java. The result of ((X)x).getClass() is
unaffected by X unless X is incompatible in which case you get a CCE.

[In due course 1.oclType() will become Integer again. UnlimitedNatural
will be dis-integrated with the numeric system requiring explicit
conversions.]

Regards

Ed Willink

On 25/04/2014 15:16, Klaas Gadeyne wrote:
> Hi,
>
> latest nightly build gives me this result in the xtext ocl console
>
> Evaluating:
> 1.oclType()
> Results:
> UnlimitedNatural
>
> Evaluating:
> 1.oclAsType(Real).oclType()
> Results:
> UnlimitedNatural
>
> I was expecting that the second expression would return Real?
>
Previous Topic:OCL expression updates
Next Topic:Wrong implication evaluation in OCL 5
Goto Forum:
  


Current Time: Fri Dec 19 09:40:29 GMT 2014

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

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