Re: Equality of simple values - Where is my mistake?

> ht writes:
> 
> I was too brief -- two simple values can only be equal if they are
> derived from the same primitive builtin type.  decimal and aST are not
> the same (previous examples) but decimal and decimal are the same
> (your example), so you're OK.  The WG is trying to clarify the wording
> on this.  I should have said two _incompatible_ types, or some such.
> 
> ht  

Ok. I understand. 

But why do we need this artificial distinction between built-in primitive
types and derived types? It seems to me that the term what is built-in
primitive should be implementation dependent. For example the xsd:decimal type is
naturally mapped to java.math.BigDecimal, xsd:integer to java.math.BigInteger,
and xsd:byte to the primitive type byte, respectively.

Comparing values can be reduced to comparing their canonical forms because
their is a one to one mapping of values to their canonical forms. This
principle can be extended to xsd:anySimpleType by having the canonical form of a
value of type xsd:anySimpleType to be its lexical form.

The advantage of using such a definition of equality, would be that
xsd:anySimpleType becomes more like a normal type with less special treatments (e.g.
one could apply enumeration and pattern facets on it). The xsd:anySimpleType
is not seen as a nebulous union of all built-in primitive types but as a real
type that is the base type of all simple types.

--Stefan

Received on Wednesday, 30 October 2002 05:19:39 UTC