W3C home > Mailing lists > Public > public-qt-comments@w3.org > September 2011

[Bug 14330] New: [XQuery30] technical: 3.1.6 Literal Function Items: static context

From: <bugzilla@jessica.w3.org>
Date: Thu, 29 Sep 2011 01:50:25 +0000
To: public-qt-comments@w3.org
Message-ID: <bug-14330-523@http.www.w3.org/Bugs/Public/>

           Summary: [XQuery30] technical: 3.1.6 Literal Function Items:
                    static context
           Product: XPath / XQuery / XSLT
           Version: Working drafts
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: XQuery 3.0
        AssignedTo: jonathan.robie@gmail.com
        ReportedBy: jmdyck@ibiblio.org
         QAContact: public-qt-comments@w3.org

3.1.6 Literal Function Items says:

"The static context for evaluation of the function item [created by a literal
function item expression] is inherited from the location of the literal
function item expression..."

First, it's incorrect to talk about "the evaluation of a function item",
because a function item is already a value. Instead, you can *invoke* a
function item, which then typically involves evaluation of the expression that
is the function item's implementation.

So, assuming that it's the latter expression whose static context is the
subject of the quoted sentence, I believe the statement is incorrect. Consider:

  declare variable $v as xs:integer := 7;
  declare function f() { $v+1 };
  let $v as xs:string := "foo"
  let $fi := f#1
  return $fi()

I think the result should be 8, but I think the quoted statement says that the
result is a type error. At the location of the literal function item expression
f#1, the static context says variable $v is of type xs:string. If you try to
evaluate the function body $v+1 in such a context, you'll get a type error. (Or
perhaps the result is undefined, if the value for $v is inconsistent with

To fix, I think we should simply delete the quoted sentence. (The new function
item's implementation is that of the referenced function, and that
implementation's static context [if it has one] is whatever it is.)

The sentence goes on to point out that the static type of the context item is
initially undefined. This is worth saying, but not here. Instead, it belongs
where function bodies are introduced: 3.1.7 "Inline Functions" already says it;
4.18 "Function Declarations" should add it.

Configure bugmail: http://www.w3.org/Bugs/Public/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
Received on Thursday, 29 September 2011 01:50:27 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 16:57:36 UTC