xsl-list
[Top] [All Lists]

Re: [xsl] current-dateTime()

2008-04-18 05:08:22


What is the reasoning behind defining as current-dateTime() and
current-time() as being "current at some time during the evaluation of
a query or transformation"?

I'm not on the WG, but this is consistent with saying that doc() and
document() etc return the same result if called twice in a transform.

Non-pure functions (even though you may end up  allowing them somewhere)
really mess up the model of a declarative functional programming
language.

In a purely declarative system it's completely safe to pull out common
code, and save values in internal variables, or conversely to not
pre-compute the value of a variable but rather inline it and evaluate
the expression (or relevant parts of the expression) wheneevr a variable
is used. It should be safe to rewrite f() - f() to zero, but if f() is
running the current time and the intention is to return teh elapsed
time, then the system needs to evaluate the function twice, and evaluate
the expressions in the required chronological order (whereas normally it
can evaluate anything in any rder, so long as it assembles the results
in the right way).

If you want to look at how a clean(ish) model disolves once you add
expressions that assume a particular execution order have a look at the
xquery scripting extension drafts:-)

XSLT2 has non pure functios anyway, as any function that generates a
new element node has these problems as each call will generate nodes
with distinct identies, even if called with the same arguments, so you
may have to allow some non pure functions somehow, but it should be
avoided if possible.




David

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--

<Prev in Thread] Current Thread [Next in Thread>