W3C home > Mailing lists > Public > public-qt-comments@w3.org > December 2002

RE: comment on Xpath 2.0 - no strong typing!!

From: Kay, Michael <Michael.Kay@softwareag.com>
Date: Mon, 9 Dec 2002 18:57:47 +0100
Message-ID: <DFF2AC9E3583D511A21F0008C7E621060453DE87@daemsg02.software-ag.de>
To: xquery@attbi.com, public-qt-comments@w3.org

> Michael Kay wrote [Thu, 3 Oct 2002 13:08:07 +0200]
> > The term "strong typing" means different things to 
> different people. 
> > There are some type rules in XPath 1.0, for example you 
> cannot supply 
> > a number as an argument to the count() function or as an operand of 
> > the "/" operator.
> >
Michael Brundage: 
> At the risk of being pedantic, I'd just like to point out 
> that "strongly typed" has a well-defined meaning, and any 
> other use of the term is just a corruption of the language.  
> See, for example, 
> http://whatis.techtarget.com/definition/0,289893,sid9_gci21305
We can quibble over minor details (as always), but the core meaning holds.

I'm not sure what you're quarrelling with in my statement. The first
sentence was just a disclaimer saying I'd prefer to avoid using the phrase
"strong typing" without defining it first: in fact I'm quite sure that many
people would disagree with the assertion in the definition that you cite
that "[strong typing] prevents the programmer from inventing a data type not
anticipated by the developers of the programming language"  

The second sentence of mine is obviously true.

MB>The confusion over XSLT/XPath stems largely from the fact that these
languages are, as you well know, only "half-way" strongly-typed.  With a
handful of exceptions (external parameters, external script functions),
every expression in XPath and XSLT 1.0 has a type that is known at
compile-time.  Granted, these types are fairly weak (number, node, etc.),
although some compile-time analysis can improve that somewhat (integer,
double, element, attribute, ...), but nevertheless, almost all expressions
in an XSLT/XPath are strongly typed.

MK>Well, the definition of "strongly-typed" that you used says "all
constants or variables defined for a given program must be described with
one of the data types", and under that definition XPath 1.0 is obviously NOT
strongly typed.

MB>I've heard the XQuery WG comment publicly several times now that XSLT is
weakly-typed and not optimizable, and I think you are doing yourselves a
disservice by resorting to flawed argumentation.  Numerous XSLT
implementations can and have successfully applied both strong-typing rules
and non-trivial optimizations (even though the standard did little to lay a
solid foundation for either).

MK>This is true. It is also true that implementations could do more
optimization if more type information were available statically. The fact
the the type of parameters is not known in advance certainly limits what an
optimizer can do.

MB>Furthermore, eliminating implicit type conversions does not make a
language more strongly-typed -- it just makes it more rigid (which can be a
positive aspect).

MK>Well, see http://www.wkonline.com/d/weak_typing.html, which says "C and
C++ are weakly typed, as they automatically coerce many types e.g. ints and

Michael Kay
Received on Monday, 9 December 2002 12:57:56 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 16:56:44 UTC