[xquery-talk] Type promotion (or URI promotion) in EBV calculation?

Martin Probst martin at x-hive.com
Tue Jan 24 09:58:21 PST 2006


Hi Jonathan,

> I don't think users have an intuition for how to use URIs as Boolean 
> values, and trying to support this just makes the language more complex 
> and more confusing. Can you think of a compelling use case?

I'm not arguing that users have an intuition to use URIs as Boolean
values, I agree with you and I generally think it's better for a
language to have a Boolean type and be strict about it.

However XQuery treats strings as booleans, and URIs as strings in many
places. You can write 'if ("foo") then ...' and you can write
'string-length(xs:anyURI("foo"))', substring etc. so in nearly every
part of the language URIs are treated as being equivalent to strings,
except for the EBV and predicates. This is confusing, at least to me.

The use case because of which I got into this was a customer with a
query as mentioned above, 'if (namespace-uri($x))' meaning if $x has a
namespace URI. I think this should be legal if 'if (string($x))' is
legal.

Martin



More information about the talk mailing list