Subject: Re: [xsl] current-dateTime() From: David Carlisle <davidc@xxxxxxxxx> Date: Fri, 18 Apr 2008 13:06:59 +0100 |
> 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
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] current-dateTime(), Andrew Welch | Thread | Re: [xsl] current-dateTime(), John Snelson |
[xsl] current-dateTime(), Andrew Welch | Date | Re: [xsl] current-dateTime(), John Snelson |
Month |