• 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
functions as sort of first class objects
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

functions as sort of first class objects


  • Subject: functions as sort of first class objects
  • From: Mitchell L Model <email@hidden>
  • Date: Tue, 24 May 2016 00:20:48 -0400

I was experimenting today and got the following confusing results:
---------------------------------------------
to a()
	display alert "A"
end a

to b()
	display alert "B"
end b

my a()	— works, of course

set c to my b	— works!
c()		— calls b!! (as I was hoping it would)

repeat with h in {my a, my b}
	h()		— error :-(
	delay 1
end repeat
---------------------------------------------

Any guesses as to why h() doesn’t work there but c() does?
I would expect both to fail or both to succeed.
I even tried changing it to “a reference to my a” (in the semi-mystical
believe that if you have a reference, it’s often good to try dereferencing it,
and vice versa), but that didn’t work either.

I want to iterate over some handlers, calling each one (for testing purposes,
in particular, in a more complicated situation than shown above).
 _______________________________________________
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


  • Follow-Ups:
    • Re: functions as sort of first class objects
      • From: Axel Luttgens <email@hidden>
    • Re: functions as sort of first class objects
      • From: Christopher Stone <email@hidden>
  • Prev by Date: Re: Script to Open Camera RAW File Doesn't Open File, Gives No Error
  • Next by Date: Re: functions as sort of first class objects
  • Previous by thread: Re: Applescript (using do javascript) to log in to a password protected webpage is failing on the button-click step
  • Next by thread: Re: functions as sort of first class objects
  • Index(es):
    • Date
    • Thread