Making the move...

Rob Cozens rcozens at pon.net
Mon Mar 20 11:03:27 EST 2006


G'day Sarah,

> In my experience, it's probably due to never passing values by
> reference.

I'm curious as to why you eschew passing by reference.

If one needs to pass large variables, why incur the overhead of 
duplicating the value of the variable before passing it?  And if a 
variable value needed at one level is derived from a routine nested 
several calls deep, simply passing the variable by reference through 
the nested calls is the simplest way to get the value back to the 
original caller.

Case in point:

An SDB record can be as large as the maximum amount of text one field 
can contain.  If the syntax of the record retrieval command were 
"getSDBRecord sdbBuffer,..." instead of "getSDBRecord @sdbBuffer,...", 
the command would have to create its own record buffer variable and 
then return a result which is copied into some other variable.  By 
passing by reference, the two handlers (or as many handlers as needed) 
can work on a single copy of the data.

Rob Cozens
CCW, Serendipity Software Company

"And I, which was two fooles, do so grow three;
Who are a little wise, the best fooles bee."

from "The Triple Foole" by John Donne (1572-1631)




More information about the Use-livecode mailing list