[Bug 1743] New: [FS] technical: 5.15 Function Declaration: a function can reference any function

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

           Summary: [FS] technical: 5.15 Function Declaration: a function
                    can reference any function
           Product: XPath / XQuery / XSLT
           Version: Last Call drafts
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Formal Semantics
        AssignedTo: simeon@us.ibm.com
        ReportedBy: jmdyck@ibiblio.org
         QAContact: public-qt-comments@w3.org


5.15 Function Declaration

SCP / rule 1 / premise 3
"statEnv1 |- FunctionDecl : Typer"
    No, you can't do this in SCP, because (as you just said) STA of
    function bodies must wait until you have a statEnv.funcType that
    contains *all* function signatures.

    Instead, back in 5 / STA / rule 1, there should be a judgment that
    typechecks function bodies, something like:
        statEnv |- func-bodies-okay-in PrologDeclList1
    which recurses down PrologDeclList1 and whenever it comes across a
    non-external FunctionDecl, performs STA on it (using a statEnv that
    knows all function signatures).

    One snag is that that statEnv will also know all declared variables,
    but a function is not allowed to reference variables that are declared
    after it in the Prolog.  In that case, maybe STA of function-bodies
    *should* be done as part of SCP, but SCP should be preceded by a phase
    that collects just the function signatures.

"Note that the static context processing is performing type checking of
the function, as defined below."
    See above.

"Note also that the type checking is done in the new environment in which
the function declaration has been added which ensures that recursive calls
are type-checked properly."
   It only handles self-recursion, not mutual recursion, not even just
   forward references.

Received on Monday, 18 July 2005 23:53:32 UTC