Hi 
 
I've just appended the attached to OMG Issue 14918. 
 
Any opinions on whether  
 
Set{ 3.oclAsType(UnlimitedNatural), 3.oclAsType(Integer),
3.oclAsType(Real) }->size() = 1. 
 
Sequence{3, 3.0}->count(3.0) = 1. 
 
is the interpretation that we want? 
 
Certainly not quite what I would have expected, but anything else seems
much worse. 
 
    Ed 
 
-------- Original Message --------
 
 
Hi 
 
The problem of value object identity is much more widespread. 
 
All the collection operations such as count(), includes() etc are based
on objects, so it is unclear whether 
 
Set{ 3.oclAsType(UnlimitedNatural), 3.oclAsType(Integer),
3.oclAsType(Real) }->size() is 1, 2 or 3. 
 
and whether 
 
Sequence{3, 3.0}->count(3.0) is 1 or 2. 
 
For 3.oclAsType(UnlimitedNatural) and 3.oclAsType(Integer) to be
different 'objects' would be very confusing, 
so 3.oclAsType(Integer) and 3.oclAsType(Real) must be the same 'object'
too. 
 
It is presumably sufficient to specify that each distinct numeric value
is notionally represented by a singleton value object of the narrowest
possible PrimitiveType. Thus 3 and 3.0 are both represented by the
3.oclAsType(UnlimitedNatural) singleton. Implementations may use
multiple non-singleton value objects, but these may not be observably
distinct. 
 
Therefore: 
 
Set{ 3.oclAsType(UnlimitedNatural), 3.oclAsType(Integer),
3.oclAsType(Real) }->size() = 1. 
 
Sequence{3, 3.0}->count(3.0) = 1. 
 
    Regards 
 
        Ed Willink 
 
On 06/01/2010 21:44, Juergen Boldt wrote:
 
  
  X-IronPort-Anti-Spam-Filtered:
true 
X-IronPort-Anti-Spam-Result: ApoEAJklP0tUXebz/2dsb2JhbADRTIQxBA 
Date: Sat, 02 Jan 2010 18:56:24 +0000 
From: Ed Willink <ed@xxxxxxxxxxxxx> 
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.0; en-GB; rv:1.9.1.5)
Gecko/20091204 Thunderbird/3.0 
To: issues@xxxxxxx 
Subject: OCL 2.1 11.2.5 Numeric = and <> operations should
compare
values 
 rather than objects 
X-Plusnet-Relay: c7b893149f9e819f734970fb3019af3e 
     
Hi 
     
OCLAny::=() is defined as 'True if self is the same object as
object2.' 
     
This is not overloaded for numeric types, and it is not specified that
a
numeric value may not have multiple instances. 
     
The definition therefore implies that: 
     
1 = 1 
     
may often evaluate to false, and that 
     
1.0 = 1 
     
must evaluate to false even though (1.0 <= 1) and (1.0 >= 1) will
evaluate true 
     
Suggest overload {Boolean, Real, String}::{=,<>} to use values
rather than objects. 
     
    Regards 
     
        Ed
Willink 
   
   
   
Juergen Boldt 
Director, Member Services 
Object Management Group 
140 Kendrick St 
Building A Suite 300 
Needham, MA 02494 
USA 
   
tel: +1 781 444 0404 x 132 
fax: +1 781 444 0320 
email: juergen@xxxxxxx 
  www.omg.org 
   
      
   
   
   
   
   
 
 
 |