Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [] Question regarding operations on UnlimitedNatur al taking UnlimitedNatural argument


"I think I got the invalid/null stuff under control using Laurent's tests."

To tell you the truth, I initially wrote these tests with the hope to refactor the EvaluationVisitorImpl ... and gave up when I saw the sheer number of failures my tests highlighted. Kudos for fixing these, I didn't expect anyone to have the courage :).

As for the "unlimited natural" part of my unit tests ... I truly doubt that there is any benefit from fixing them : few people will even realize that "*" parses as a special value; and even for those that do, who in the world (except the nasty jerk that wrote these unit tests :p) would write anything that uses this value? I don't even really understand why it is mentionned in the OCL specification, but I don't think it has any other use than the " = " and " <>" operations to check the upper bound of a reference. Really, why would we want to write something like :

"* * *"
"* / 1"

I think these parts of my unit tests should be commented out/deleted. Fixing the unlimited issue is too much trouble for the "mature" OCL : it might be fixed in the future pivot-based implementation ... but even there I don't think it should be a priority.

Just my 2 cents.

Laurent Goubet

On 19/04/2011 09:25, Axel Uhl wrote:
Aside from the 3.0 vs. 3 issue particularly in collections and the polymorphic collection operation lookup that doesn't work as expected, I think I got the invalid/null stuff under control using Laurent's tests. After commenting the collections tests with a FIXME where inherited operation specs are not found, and after commenting the 3.0 vs. 3 issues, also with a FIXME, I have only 9 failures left which all have to do with UnlimitedNatural. Those, however, are nasty particularly because the Integer-defined operations are not resolved for an UnlimitedInteger. So if we parsed non-negative integer literals as UnlimitedNaturalLiteral we'd currently mess things up as 1.+(-1) wouldn't be resolved because -1 is not an UnlimitedNatural, 1 is, and we have UnlimitedNatural::+(UnlimitedNatural), and Integer::+(Integer) is not found.

I'm inclined to at least for the special case of UnlimitedNatural introduce the superclass lookup in AbstractTypeChecker.findOperationMatching. This would solve the nasty UnlimitedNatural issue reliably, I think. I'll give it a try.

-- Axel

On 4/18/2011 4:30 PM, Willink, Ed wrote:
HI Axel

It's not easy. - I gave up.

The mature parser was written before UnlimitedNatural was properly
identified. I think only '*' is parsed as unlimited natural, although all
non-negative integers should be.

1.oclIsTypeOf(UnlimitedNatural) = true.

'*' really is a mess, requiring conversion to invalid when assigned to
Integer variable.

I have raised an OMG issue suggesting that +infinity, at least, exist for
all numerics.


I suggest that you try to bound your ambition to correct the mature code.

My intention was to do just 1% of the fixes and move on to the pivot for the

You may well be able to do 50%, perhaps even 75%, but is that really worth



-----Original Message-----
[] On Behalf Of Axel Uhl
Sent: 18 April 2011 15:22
To: MDT OCL mailing list
Subject: [] Question regarding operations on
UnlimitedNatural taking UnlimitedNatural argument


there are operations defined on UnlimitedNatural in the 2.3
spec which
as argument take an UnlimitedNatural (e.g., div, mod, max,
min and the
comparison operations). The current parser creates IntegerLiteralExp
expressions for non-negative integer literals such as 0, 1, ...

This leads to a glitch for expressions such as


because * parses to an UnlimitedNaturalLiteralExp, 1 parses to an
IntegerLiteralExp, Integer does not conform to UnlimitedNatural and
hence the operation UnlimitedNatural::div(UnlimitedNatural) is not

Now, Integer::div(Integer) would be applicable, but it's not
clear to me
whether these operations should be visible for the specialization
UnlimitedNatural. What's your take on this?

Currently, the "mature" implementation for Ecore gives up on any
expression of this sort, and I wonder whether and how to fix it.

-- Axel
_______________________________________________ mailing list

Please consider the environment before printing a hard copy of this

The information contained in this e-mail is confidential. It is intended
only for the stated addressee(s) and access to it by any other person is
unauthorised. If you are not an addressee, you must not disclose, copy,
circulate or in any other way use or rely on the information contained in
this e-mail. Such unauthorised use may be unlawful. If you have received
this e-mail in error, please inform us immediately on +44 (0)118 986 8601
and delete it and all copies from your system.

Thales Research and Technology (UK) Limited. A company registered in
England and Wales. Registered Office: 2 Dashwood Lang Road, The Bourne
Business Park, Addlestone, Weybridge, Surrey KT15 2NX. Registered Number:

Thales UK Limited. A company registered in England and Wales. Registered
Office: 2 Dashwood Lang Road, The Bourne Business Park, Addlestone,
Weybridge, Surrey KT15 2NX. Registered Number: 868273
_______________________________________________ mailing list

_______________________________________________ mailing list

fn:Laurent Goubet
org:<a href="";>Obeo</a>

Back to the top