On 27-Jul-12 23:09, Paulo Pinto wrote:
On Friday, 27 July 2012 at 19:04:07 UTC, Stuart wrote:
On Friday, 27 July 2012 at 16:28:50 UTC, Dmitry Olshansky wrote:

But this advantage is unimportant since arbitrary deep recursion is a
security risk (especially for servers that typically use threads with
tiny stacks).

I would like to point out here that the example VB.NET code I just
gave for lazy-populating a list of all files on a drive uses NO
recursion whatsoever.


It sure thing would. Just list your code to do so. Recursively scan all files on drive does involve stack or recursion.

If you mean list all files shallowly then of course no recursion takes place (but then ranges will do the same no problem).

Recursion isn't just a security risk - it's a performance hit as well.

Only in languages without tail call optimizations.

Tail call won't do. Precisely because call in this function saves state. In effect you maintain the same stack of directories but implicitly so though hardware call stack with locals.



--
Dmitry Olshansky

Reply via email to