This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 5786 - [FS] improve static typing of fn:trace()
Summary: [FS] improve static typing of fn:trace()
Status: RESOLVED FIXED
Alias: None
Product: XPath / XQuery / XSLT
Classification: Unclassified
Component: Formal Semantics 3.0 (show other bugs)
Version: Working drafts
Hardware: PC Linux
: P2 normal
Target Milestone: ---
Assignee: Michael Dyck
QA Contact: Mailing list for public feedback on specs from XSL and XML Query WGs
URL:
Whiteboard: need to edit 1.1 doc
Keywords:
Depends on:
Blocks:
 
Reported: 2008-06-23 13:46 UTC by Liam R E Quin
Modified: 2008-10-14 17:52 UTC (History)
0 users

See Also:


Attachments

Description Liam R E Quin 2008-06-23 13:46:27 UTC
See bug 3784 for details:

[[
Since the return type for fn:trace isn't inferred from the input it is tracing,
one must in most cases insert a 'treat as' expression each time one inserts an
fn:trace call. I would find this very cumbersome. For example, this query is a
static typing error:

trace("this Input is traced", "The trace message.") eq "a string"

because the left operand to 'eq' has item()* as static type.

I suggest that a section is added for fn:trace, and that its return type is
inferred similarly to fn:reverse().

This is a large change, but the specification also has a large hole here, in my
opinion. fn:trace() is very unpractical on a static typing implementation as it
is now.
]]
Comment 1 Michael Dyck 2008-10-14 17:52:02 UTC
At their meeting today, the WGs approved the request for FS 1.1 to provide
a specific static typing rule for calls to fn:trace.

The original submission suggested that the type be inferred "similarly to
fn:reverse()", which is:

    --------------------------------------------------------------------
    statEnv |- (FN-URI,"reverse")(Type) : prime(Type) ยท quantifier(Type)

but for fn:trace, it shouldn't be necessary to factor the type. The static
type of the call can simply be the static type of the first argument.
That is:

    Type2 <: xs:string
    -------------------------------------------------
    statEnv |- (FN-URI,"trace")(Type1, Type2) : Type1

Given this decision, I am marking this issue resolved-fixed. (I'm not sure
who should close it, Liam Quin or Frans Englich.)