[Bug 4611] [UPD] Better error specification for updating function with declared return type

http://www.w3.org/Bugs/Public/show_bug.cgi?id=4611

           Summary: [UPD] Better error specification for updating function
                    with declared return type
           Product: XPath / XQuery / XSLT
           Version: Working drafts
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Update Facility
        AssignedTo: andrew.eisenberg@us.ibm.com
        ReportedBy: john.snelson@oracle.com
         QAContact: public-qt-comments@w3.org


In section 2.5.6.2.a the XQuery Update specification states:

as SequenceType must not be specified because, in the current design, the XDM
instance returned by an updating expression is always the empty sequence.

The EBNF grammar production for a function declaration is this:

[26] FunctionDecl ::= "declare" "updating"? "function" QName "(" ParamList? ")"
("as" SequenceType)? (EnclosedExpr | "external")

Since the grammar production does not disallow the specifying of a return type,
I believe we need to take one of two actions:

1) Specify an error code for the static error to be raised in the event of a
return type being present.

2) Tighten the EBNF grammar production to disallow a return type when
"updating" is used, thus including such a use under error [err:XPST0003]. This
could be done by replacing grammar production 26 with the following:

[26] FunctionDecl ::= NonUpdatingFunctionDecl | UpdatingFunctionDecl

[26a] NonUpdatingFunctionDecl ::= "declare" "function" QName "(" ParamList? ")"
("as" SequenceType)? (EnclosedExpr | "external")

[26b] UpdatingFunctionDecl ::= "declare" "updating" "function" QName "("
ParamList? ")" (EnclosedExpr | "external")

Received on Friday, 8 June 2007 17:57:17 UTC