Re: Re: Function memoization
Florent Georges <[email protected]>
| Newsgroups | gmane.text.xml.xslt.extensions |
|---|---|
| Message-ID | <[email protected]> |
Dimitre Novatchev wrote: Dimitre, Thanks a lot for your clear explanations. > The *only* type of an xsl:function that can produce different > results when called twice with the same arguments is one that > creates nodes -- with instructions such as xsl:copy, > xsl:copy-of, xsl:element, xsl:attribute, ..., etc. > Every time such a function is evaluated it will produce a new > (different!) node or sequence of nodes. So the result can be different only by its identity, not by its value, right? If it is, I think your warning below is a little too strong. Warning that identity of the result can not be relied on could be enough, isn't it? Because when the memoisation is supported by an implementation, the results will be required to be identical, but when memoisation is not supported the results will never be identical (by construction). Put in "simple words": "you can't rely on the 'is' operator for such results". And I guess identity tests are not usual on such results; I guess they are more often used on nodes in input trees (it is just a guess). > "Memoisation of an impure function (one that has side effects) will > generally have unpredictable results that conflict the semantics of > such a > function. Doing so is illegal. As function impurity could be > difficult to > ascertain, an implementation is not required to issue an error > message for > specifying memoisation for an impure function and the sole > responsibility > of doing so remains with the xslt programmer". Because we are talking about memoisation, it seems natural that the identity can't be trusted, isn't it? Maybe I missed something? Thanks for the explanation. Regards, --drkm ___________________________________________________________________________ Yahoo! Mail réinvente le mail ! Découvrez le nouveau Yahoo! Mail et son interface révolutionnaire. http://fr.mail.yahoo.com