ASPN ActiveState Programmer Network
ActiveState
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups


Recent Messages
List Archives
About the List
List Leaders
Subscription Options

View Subscriptions
Help

View by Topic
ActiveState
.NET Framework
Open Source
Perl
PHP
Python
Tcl
Web Services
XML & XSLT

View by Category
Database
General
SOAP
System Administration
Tools
User Interfaces
Web Programming
XML Programming


MyASPN >> Mail Archive >> exslt
exslt
Re: [exslt] Re: Function memoization
by Dimitre Novatchev other posts by this author
Jul 14 2006 9:57PM messages near this date
Re: [exslt] Re: Function memoization | Re: [exslt] Re: Function memoization
& XSLT Hi Florent,

I sense a great deal of confusion in your message -- let's move the
discussion off-list in case you have further questions.

The problem of memoising impure functions is in the fact that memoisation
strips the impure function of its (every time different) side effect and
typically the side effect is what was desired by the authors of the
function.

Also, by not recognising sequence arguments as the same, there will be the
very confusing behaviour that sometimes side effects show from evaluating
an impure function, and sometimes there are no side effects -- this is
exactly what we are talking about.

So we need just to say: do not try to memoise an impure function -- this
is immoral and the results will be unpredictable.

Cheers,
Dimitre

--- Florent Georges <darkman_spam@[...].fr>  wrote:

>  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
>  


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 
_______________________________________________
exslt mailing list
list@[...].org
http://www.exslt.org/list
Thread:
Dimitre Novatchev
Colin Paul Adams
Dimitre Novatchev
Dimitre Novatchev
Colin Paul Adams
Florent Georges
James Fuller
Colin Paul Adams
Florent Georges
Dimitre Novatchev
Florent Georges
Dimitre Novatchev
Florent Georges
Dimitre Novatchev
Colin Paul Adams
Frans Englich
Florent Georges

Privacy Policy | Email Opt-out | Feedback | Syndication
© ActiveState Software Inc. All rights reserved