Is it safe to return an array from a function?

Dave Kilroy dave at applicationinsight.com
Mon Sep 21 04:44:18 EDT 2015


Peter - looking at your post again makes me think your 'returns 2' must have
been a typo (phew) - let me know if not...

Page 8 of the Release Notes for LC 7.0.0(rc2) states:


> Array element pass by reference (7.0.0-rc-2)
> 
> It is now possible to pass parts of an array by reference. For example,
> the following
> 
> on mouseUp local tArray
> put "" into tArray[1][2] passByRef tArray[1]
> put tArray[1][2]
> end mouseUp
> 
> on passByRef @rArray
> put "changed" into rArray[2]
> end passByRef
> 
> in the script of a button will result in "changed" appearing in the
> message box when the button is pressed.
> 
> This allows users to reduce the overhead associated with passing
> sub-arrays to handlers, as this would no longer require copying the
> sub-array internally.

But this says nothing about arrays returned from functions - so you have a
VERY GOOD QUESTION - at a guess I should think that the well-established
'return' routines would trump any new-fangled 'referencing' functionality
(otherwise how many apps would suddenly start crashing?). 

But it would indeed be nice to get confirmation from someone who knows...

Kind regards

Dave



-----
"The difference between genius and stupidity is; genius has its limits." - Albert Einstein
--
View this message in context: http://runtime-revolution.278305.n4.nabble.com/Is-it-safe-to-return-an-array-from-a-function-tp4696483p4696488.html
Sent from the Revolution - User mailing list archive at Nabble.com.




More information about the use-livecode mailing list