Re: recursion testing (was: Finder - Delete empty folders, recursively)
Re: recursion testing (was: Finder - Delete empty folders, recursively)
- Subject: Re: recursion testing (was: Finder - Delete empty folders, recursively)
- From: Graff <email@hidden>
- Date: Tue, 15 Jun 2004 19:22:43 -0400
On Jun 15, 2004, at 6:57 PM, Jon Pugh wrote:
At 4:44 PM -0300 6/15/04, Bill Briggs wrote:
At 11:24 PM -0400 14/06/2004, Graff wrote:
After a fraction of a second I get a dialog that says "failed at:
284"
Yup. 284 here. OS X 10.3.4. PowerBook 667 with 768 Megs RAM.
This is error 28, stack overflow, although the script is eating the
error message.
If you control the application running the script, then you could tell
AppleScript to use a larger stack to increase the amount of stack
space beyond AppleScript's default. In older applications this is
even exposed for modification via the "scsz" resource which is
described in AEUserTermTypes.r. Most developers don't bother because
you can almost always implement recursive algorithms more efficiently
with iteration and heap based storage.
Yeah, I figured this was a stack overflow. That's pretty typical for
recursion, it's only as good as the amount of stack available. Like
you said, applications can usually increase their stack to avoid this.
All the same I usually only use recursion where I'm pretty sure I won't
need to do it too deeply. On those occasions I turn toward iteration
or using the heap more effectively.
- Ken
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.