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 10:16 Go to next message
Klaas Gadeyne is currently offline Klaas Gadeyne
Messages: 86
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 10:46 Go to previous message
Ed Willink is currently offline Ed Willink
Messages: 4014
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: Sat Aug 02 00:32:48 EDT 2014

Powered by FUDForum. Page generated in 0.07082 seconds