OK to pass big data in 'the result'?
Sarah Reichelt
sarah.reichelt at gmail.com
Thu Mar 15 20:38:16 EDT 2007
On 3/16/07, Phil Davis <revdev at pdslabs.net> wrote:
> Is anyone aware of any drawbacks in using 'the result' as a container for
> passing, say, a bunch of records from one handler to another? Like this:
>
>
> on processRecords
> getRecords
> put the result into tRecordList
> repeat for each line tLine in it
> -- your code here
> end repeat
> end processRecords
>
>
> on getRecords
> put the uBigList of stack "XYZ" into tList
> delete stack "XYZ" -- to remove it from memory
> return tList
> end getRecords
I don't see any problems with this Phil. So long as the data is in
variables and not in fields, then access is extremely fast almost
regardless of size. As a matter of style, I would make getRecords a
function - as a general rule, if a handler has to return data, then
use a function.
So here is my version:
on processRecords
put getRecords() into tRecordList
-- other processing
end processRecords
function getRecords
put the uBigList of stack "XYZ" into tList
delete stack "XYZ" -- to remove it from memory
return tList
end getRecords
Note the parentheses after the call to getRecord - with a function,
you have to have these and they would enclose any parameters if you
needed to send any.
Regards,
Sarah
More information about the use-livecode
mailing list