RE: [xsl] XPath 2.0 Functions - numeric constructors

Subject: RE: [xsl] XPath 2.0 Functions - numeric constructors
From: "Michael Kay" <michael.h.kay@xxxxxxxxxxxx>
Date: Tue, 8 Jan 2002 13:28:05 -0000
> I am getting a bit perplexed by numeric constructors in:
>
> http://www.w3.org/TR/xquery-operators/
>
>
> 1)
>
> [Issue 149: Either the constructor functions should allow dynamic
>    expressions or the syntax should be changed so that they
> do not appear
> to   be functions. ]
>
> What is meant by dynamic expressions? Does it mean that the
> argument must
> be "12" but something like (xf:short(xf:concat("1","2")) will not be
> permitted ?

The text of issues is not always very exact! What this issue is asking for
is that constructors be changed either (a) to behave like ordinary
functions, in which any expression can be supplied as an argument, or (b) to
not use the same syntax as function calls.
>
> 2)
>
> notation looks a bit perplexing:
> xf:short(string $srcval) => integer
> xf:byte(string $srcval) => integer
> ...
> ...
>
> should not it be rather:
> xf:short(string $srcval) => short
> xf:byte(string $srcval) => byte
> ...
> ...
> ?

I suspect it probably should. We've been round a few loops on this one, and
it depends on whether you're talking about the static type or the dynamic
type. At one stage we were proposing that the static type of the result of
xf:short() would be short, but the dynamic type would be integer. That's
changed. But I don't think the type system is completely bedded down yet, so
expect further changes.
>
> 3)
> Standard says:
>
> If the argument string passed to a constructor results in an error
> (for example, if it conatains a letter other than "E" or "e"
> or a string
> other than the special values named above), the constructor
> returns the
> error value as defined in [XQuery 1.0 and XPath 2.0 Data Model].
>
>
> But
> http://www.w3.org/TR/query-datamodel/#error
>
> is very vague. What will be the return value
> or will it be a fatal error?
>
Again, the terminology on errors is rather variable. There's a recognized
need to provide some kind of construct for trapping errors, hence the
terminology "returns the error value". At present if something returns the
error value then that's generally fatal, except in contexts like

  some $x in X satisfies f($x)

where the result is true if at least one execution of f($x) returns true,
even if other executions of f($x) return the error value.

Mike Kay


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread