focus over function calls

Section 3.1.4 of the new main XQuery specification says:

    A function does not inherit a focus (context item, context
    position, and context size) from the environment of the function
    call. During evaluation of a function body, the focus is undefined,
    except where it is defined by the action of some expression inside
    the function body. Use of an expression that depends on the focus
    when the focus is undefined results in a dynamic error.

Why a dynamic error?  It seems like this could and should be a static
error:  An expression that depends on the focus is defined iff the
expression appears inside a function definition but not in a predicate.
And there are only a fixed predefined set of "functions" that depend
on the focus, so we can easily detect this error statically.

I put "function" in quotes, because according to this specification an
expression like 'position()' is *not* a function call, but it is rather
a "macro" (syntax) equivalent to '$fs:position'.
-- 
	--Per Bothner
per@bothner.com   http://www.bothner.com/per/

Received on Saturday, 19 October 2002 08:47:17 UTC