Re: passing handler problems and a resolution
Re: passing handler problems and a resolution
- Subject: Re: passing handler problems and a resolution
- From: Walter Bushell <email@hidden>
- Date: Wed, 26 Jan 2011 14:50:12 -0500
<snip>
On Jan 26, 2011, at 12:10 PM, Axel Luttgens wrote:
>
> Hello Walter,
>
> Indeed, it seems that in an expression such as
>
> somename(x, y, ...)
>
> the name "somename" needs to be a top-level one for having a chance to be evaluated before the actual handler invocation occurs.
> Never noticed the fact.
>
> That said, you may avoid to declare "somename" as a global everywhere in your code; just declare as such where really needed, and be sure to use very specific names so as to avoid potential clashes; for example:
>
> on run
> zroutine({yroutine, 5, 7})
> end run
>
> to zroutine(myParameter)
> global zroutine_internal_param1
> local x, y
> set {zroutine_internal_param1, x, y} to myParameter
> zroutine_internal_param1(x, y)
> end zroutine
>
> to yroutine(x, y)
> return x + y
> end yroutine
>
> HTH,
> Axel
>
Bonjour Alex,
Thanks for the fine point, and I do appreciate the declaration of local variables (x & Y) in your code an nice touch.
Now if we could get Applescript to flag variables that are *not* declared anywhere, that would be awesome. As it is, any time saved (ha!) by not having to declare variables is lost by misspellings.)
--
A computer without Microsoft is like a chocolate cake without mustard.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden