xsl-list
[Top] [All Lists]

Re: [xsl] Maximum recursion depth exceeded

2009-07-07 12:39:22
I never said that Tail recursion is not supported in XSLT or
system.xml.xsl. I said that the only .NET language I am aware of where
it is supported is F# - I'm not sure if I would consider an XSLT
compiled via XslCompiledTransform  to be a '.NET language' (I believe
I used the example of C#) , I haven't really thought about it though -
would you say it is?



I don't know what is your definition for a ".NET Language".
XslCompiledTransform is the latest .NET implementation of the XSLT 1.0
language. Whether XslCompiledTransform or F# are written in C# (or
VB.NET or any other language supported by the platform) has nothing to
do with the fact that they are language implementations officially
provided by .NET


but
it is annoying when I know I have a function that is properly tail
recursive and it overflows anyway...(This would be a C# problem, not
XSLT in System.XML.XSL)

This would be XSLT implementation problem (nothing to do with
recursion in C#), and only implementation problem, because there is no
text in the Specs of XSLT 1.0/2.0 that mandates the recognition and
optimization of tail recursion.

From my experience using XslCompiledTransform I know that it optimizes
tail-recursion if Debug mode is not specified when creating the
instance of XslCompiledTransform:

http://msdn.microsoft.com/en-us/library/ms163418.aspx


-- 
Cheers,
Dimitre Novatchev
---------------------------------------
Truly great madness cannot be achieved without significant intelligence.
---------------------------------------
To invent, you need a good imagination and a pile of junk
-------------------------------------
Never fight an inanimate object
-------------------------------------
You've achieved success in your field when you don't know whether what
you're doing is work or play




On Tue, Jul 7, 2009 at 6:41 AM, bryan
rasmussen<rasmussen(_dot_)bryan(_at_)gmail(_dot_)com> wrote:
On Tue, Jul 7, 2009 at 3:16 PM, Dimitre 
Novatchev<dnovatchev(_at_)gmail(_dot_)com> wrote:
On Tue, Jul 7, 2009 at 1:19 AM, bryan
rasmussen<rasmussen(_dot_)bryan(_at_)gmail(_dot_)com> wrote:
On Tue, Jul 7, 2009 at 9:55 AM, Michael Kay<mike(_at_)saxonica(_dot_)com> 
wrote:
anyway, recursion problems are likely to be a problem in .NET
/ C#, as far as I know currently the only .NET language that
can compile and optimize for tail recursion is F#..

Well, I know of at least two others: XSLT and XQuery, as implemented by
Saxon.

I don't think those would be considered as .NET languages, those are
languages implemented in .NET. Sorry if I was imprecise earlier.


1. Quite some of Bryan's statements about how "System.Xml.Xsl" does
work are far from correct. One of them is that tail recursion is not
supported. Tail recursion *is* optimized by XslCompiledTransform in
non-debugging mode.

I never said that Tail recursion is not supported in XSLT or
system.xml.xsl. I said that the only .NET language I am aware of where
it is supported is F# - I'm not sure if I would consider an XSLT
compiled via XslCompiledTransform  to be a '.NET language' (I believe
I used the example of C#) , I haven't really thought about it though -
would you say it is?

2. To the original OP: The message by Saxon is generally presented
whenever Saxon runs out of memory -- this may or maynot be caused by
recursion stack overflow!


To summarize: Prefer using DVC recursion to tail-recursion as a
practical way to avoid the recursion stack overflow problem.

you're right of course, specifically as regards the practicality - but
it is annoying when I know I have a function that is properly tail
recursive and it overflows anyway...(This would be a C# problem, not
XSLT in System.XML.XSL)


Cheers,
Bryan Rasmussen

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



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