Passing parameters by reference

Bob Sneidar bobs at twft.com
Mon Mar 12 17:04:36 CDT 2012


Just weighing in here, that would be a bit confusing. Passing by reference means that the command or function has access to the variable passed to it. By passing what amounts to a statement, there is nothing for LC to manipulate on the other end. Statements have to have some place to put the results. In this case, there is no place for LC to put the statement when passed by reference. 

Even a reference to an element of an array is a statement of sorts. That the command is in essence the characters for key delimiters [] doesn't change that. The array that is an element in a multidimensional array is not itself a container. The array is the container. To work with it you have to put it into it's own container then pass the new array by reference. 

I hope that makes sense. At least it does to me. :-) 

Bob


On Mar 10, 2012, at 11:53 AM, Dar Scott wrote:

> Thanks for the tip, Dick, on using the list of keys.  One can think of arrays as nested or multidimensional.
> 
> On Mar 10, 2012, at 1:06 AM, Dick Kriesel wrote:
>> I agree it'd be good if LC could accept any array reference for invoking a handler that specifies pass-by-reference.
> 
> Though is is probably more work, one might also consider chunks in pass-by-reference.
> 
> Maybe any thing the subtract command can take.
> 
> However, this might be a problem:
> 
> doSomethingToTheseTwo char 1 to 2 of it, char 2 to 3 of it
> 
> command doSomethingToTheseTwo @a, @b
> 	put "butter" into a
> 	put "cheese" into b
> 	put empty into a
> end doSomethingToTheseTwo
> 
> That might also have a problem with this call:
> 
> doSomethingToTheseTwo x, x["t"]
> 
> I immagine LiveCode folks can come up with a semantics that makes sense for weird cases.  
> 
> The subtract command does not have the the problem because it modifies only one thing.
> 
> Dar
> 
> 
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode




More information about the use-livecode mailing list