• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag
 

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: passing handler problems and a resolution
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

References: 
 >passing handler problems and a resolution (From: Walter Bushell <email@hidden>)
 >Re: passing handler problems and a resolution (From: Axel Luttgens <email@hidden>)

  • Prev by Date: Re: 'my' problem is your problem: it chokes without 'my'! BUG
  • Next by Date: Anyone know how to trash finder window view settings?
  • Previous by thread: Re: passing handler problems and a resolution
  • Next by thread: Re: AppleScript-Users Digest, Vol 8, Issue 56
  • Index(es):
    • Date
    • Thread