Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [mdt-ocl.dev] Working on the incorrect commonSuperType

Hi, Adolfo,

See some replies in-line, below.

Cheers,

Christian

On 12-Jan-09, at 8:14 AM, Adolfo Sánchez-Barbudo Herrera wrote:

Hi Christian,

Another consideration...It seems that AbstractTypeChecker.mutuallyComparable must be revised as well:

- Now, UnlimitedNatural shouldn't be comparable with Integer or Real.

Right, assuming that it won't be a subtype of Real (see my other reply).


- Before that method didn't take into account that OclAny is the common supertype of every type (if they are not collections). Fortunately, OclAny have the comparison operations (=, <>, <, >, <=, >=), so I suppose that every object (excepting the unrelated collections) should be considered as comparable.

Ugh, this is actually a problem.  The OclAny type should only have = and <> operations.  Another 2.0 item.


Here some questions:
    * Does this method have any other intention which I could be missing ??

Actually, this method has nothing to do with the notion of being comparable in the sense of partial or full ordering, or java.util.Comparable.  It is only meant to check that asking two objects whether they are the same ("=") or different ("<>") makes sense.  Formerly, this checked that they had some common supertype, but that was relaxed in the 1.2 release (because it was a bogus constraint).

Now, letting all types have OclAny as a common supertype will completely obsolete this particular method.


    * How should the implementation evaluate a '>' operation when dealing with different classes which have the OclAny type as commonSuperType ?

OclAny shouldn't have this operation, anyway.  I'm fairly sure that the parser already doesn't actually let model classes inherit <, <=, >, and >= from OclAny.  What happens if you try to compare, say, two Books with ">" ?  These operations were originally defined on OclAny to support java.util.Comparable data types, but that was done away with long ago.


Cheers !!!
Adolfo.

--
<logo.jpg>
Adolfo Sánchez-Barbudo Herrera
adolfosbh(at)opencanarias(dot)com
C/Elías Ramos González, 4, ofc. 304
38001 SANTA CRUZ DE TENERIFE
Tel.: +34 922 240231 / +34 617 718268
_______________________________________________
mdt-ocl.dev mailing list
mdt-ocl.dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/mdt-ocl.dev

--
Christian W. Damus
Senior Software Developer, Zeligsoft Inc.
Component Lead, Eclipse MDT OCL and EMF-QTV




Back to the top