Re: Reversing the lines in a file[speed, stack overflow}
Re: Reversing the lines in a file[speed, stack overflow}
- Subject: Re: Reversing the lines in a file[speed, stack overflow}
- From: has <email@hidden>
- Date: Fri, 10 May 2002 20:36:31 +0100
Cornwall wrote:
>
But - at somewhere between 4000 and 4500 lines, it errors with a 'stack
>
overflow' error. I guess I had never tried it with such large a file.
>
>
Although slower, Paul's example does not error in that fashion (I tested
>
up to about 6000 lines).
>
Why does the first example error when the second does not?
The first errors because the "paragraphs of [some string]" construction is
coercing a string into a list of items (in this case by paragraph). There's
a longstanding and fairly well-known issue with creating lists containing
more than [approx] 4000 items in AS, whereupon it suddenly fails with the
aforementioned "Stack Overflow" error.
I would assume that the second, where the 'read file' call is itself
responsible for assembling and returning the list, doesn't error because
the list there is assembled in a different fashion, perhaps by a different
type of routine that doesn't suffer this particular "oops, I ran outta
working space" flaw, or perhaps by adding one item at a time to the list
object [which is an approach - albeit a slower one - that doesn't error in
regular AS either].
All this is why somebody <cough> [can't imagine who] wrote a library
<cough> [can't imagine what] that let you work around this stack overflow
issue in considerable comfort. Alas, it still isn't as well known as the
error itself, but no doubt my total lack of shame and incessant self
promotion will rectify this issue eventually [most likely about the same
time as Apple finally fix that damned bug...<g>].
Cheers,
has
--
http://www.barple.connectfree.co.uk/ -- The Little Page of Beta AppleScripts
_______________________________________________
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.