That actually is a great explanation which solves a mystery I've often 
wondnered about, which is how a handler with a different variable name can 
contain the *actual* original variable. I thought the engine actually created a 
new variable and copied the incoming value to it, and then reversed this 
operation on return. Aliasing makes perfect sense. 

Bob S


> On Aug 18, 2017, at 08:13 , Mark Waddingham via use-livecode 
> <[email protected]> wrote:
> 
> In fact, what is happening is aliasing of variables:
> 
>  myHandler @tFoo -- when tFoo is passed to myHandler, xFoo1 in myHandler is 
> aliased to tFoo
> 
>  command myHandler @xFoo1 -- xFoo1 as a variable does not exist, it is an 
> alias to the calling var
>    myOtherHandler @xFoo -- xFoo *is* tFoo, we are passing by-ref again so use 
> @ which 'passes the alias on'
>  end myHandler
> 
>  command myOtherHandler @xFoo2 -- xFoo2 as a variable does not exist, it is 
> an alias to the calling var
>    answer xFoo2 -- xFoo2 *is* tFoo
>  end myOtherHandler
> 
> Perhaps I'm not explaining this very well - or there is something I'm 
> missing...
> 
> Warmest Regards,
> 
> Mark.
> 
> -- 
> Mark Waddingham ~ [email protected] ~ http://www.livecode.com/
> LiveCode: Everyone can create apps


_______________________________________________
use-livecode mailing list
[email protected]
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

Reply via email to