[
Lists Home |
Date Index |
Thread Index
]
On Thursday 05 December 2002 10:10, Robin Berjon wrote:
> Alaric B. Snell wrote:
> > I don't think so. Adding more restrictive typing doesn't change the data
> > in the documents, it just makes automated processing easier. Instead of
> > allowing a date field to contain "yesterday", "my birthday", "1/2/2002"
> > (note the ambiguity; 1st feb or 2nd jan) and so on you restrict it to a
> > specific date type written "YYYY-MM-DD", and the increased rigidity makes
> > it possible to write code that can be shown to handle all the cases.
>
> But...that's not at all stronger typing, it's stronger syntax.
That's a big part of what typing can be for XML. Rather than a wooly
description that this element contains a date (the kind of typing that
happens in so-called "untyped" XML), instead referencing a formally defined
type.
The argument about xs:decimal, xs:double, etc is a bit of a red herring - as
any programmer knows, real and double are approximate binary floating point
types. XSD's bad for forcing its users to know what programmers know; ASN.1
has a much nicer model where the type REAL really means a real number and you
have to explicitly add constraints on the precision to make it act like an
IEEE real.
When the spec says that xs:decimal has 'arbitrary' precision it does not
(well, from other use of the same term in other contexts, *should* not) mean:
1) That implementations can arbitrarily drop precision
2) That implementations have to allocate all available memory for the buffer
As any decent programmer will tell you, arbitrary precision types are so
named because they give the *user* arbitrary precision, and if the machine
doesn't have enough memory to represent what the user provides then it's the
same problem as when a Java String type is told to handle a piece of text too
large to fit into virtual memory, no more no less.
The XSD spec's wording may or may not be broken, however.
> > Yeah! ASCII, DNS, TCP/IP and all those other tightly defined binary
> > protocols just need to be rewritten every year, don't they?
>
> I think we'd have loved to get a chance to rewrite ASCII, only that proved
> difficult to do too early.
Hardly anybody has rewritten ASCII, but there are lots of extensions to it,
only a few of which are really taking off :-)
ABS
--
A city is like a large, complex, rabbit
- ARP
|