Deleting lines within a 'repeat for each' loop

Jan Schenkel janschenkel at yahoo.com
Tue Aug 19 10:19:00 EDT 2003


--- Björnke_von_Gierke <bvg at mac.com> wrote:
> 
> [snip]
> 
> Eh? I always thought that the repeat for each loop
> copies the content 
> it loops over and then uses that too loop. This is
> so that looping in 
> fields is not slower then looping in a variable. In
> fact looping a 
> variable IS NOT faster then looping a field (I
> tested that). 
> Unfortunately the fact is that deleting lines in a
> fashion as the above 
> WILL result in rubbish. I am kinda lost, shouldn't
> the one fact 
> contradict the other????
> 

I don't think there's a contradiction : after all,
MetaCard stacks are entirely RAM-based so it should be
no slower to access a variable than to access the
contents of a field.
In the old HyperCard days, its engine had to load the
field text from disk, and every manipulation meant
writing to disk, updating the hintbits for its quick
find algorithm etc.
But I'm sure there'll be a performance hit when you
manipulate the contents of a field in a repeat for
each loop, as the screen needs to be redrawn.
Of course only Mr Raney knows for sure, but I think
the content isn't copied, and that during a 'repeat
for each' the engine merely remembers the last line
delimiter position and the next line delimiter
position as it munches away the data.

Jan Schenkel.

=====
"As we grow older, we grow both wiser and more foolish at the same time."  (La Rochefoucauld)

__________________________________
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder.yahoo.com



More information about the use-livecode mailing list