Altova Mailing List Archives


Re: [xsl] current-dateTime()

From: David Carlisle <davidc@--------->
To:
Date: 4/18/2008 12:08:00 PM
> 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

Disclaimer

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.