• 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: Load Script
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Load Script


  • Subject: Re: Load Script
  • From: Luther Fuller <email@hidden>
  • Date: Sun, 05 Jun 2011 10:40:12 -0500

On Jun 4, 2011, at 3:31 AM, Axel Luttgens wrote:

> You are considering a "caller script" calling a "called script", and I already suggested several times throughout the thread that this doesn't imply a parent/child relationship. The fact that you sometimes could reach the caller's properties doesn't mean that this has been through inheritance...

And I agree with your analysis of the situation. On Friday evening, I had done some experimenting on the "parent/child" relationship and inheritance as described in ASLG, chapter 4, and had come to conclusion that the "parent/child" relationship is NOT applicable to using 'run (load script ...)'. But, what about inheritance?

Continued experimenting revealed that properties ARE inherited by the called script, but as globals, not properties. That is ...

	MY DOCUMENTATION:
	If a script running as application bundle calls a script (.scpt) file using
		run (load script aliasToScriptFile)
	Then:
		1.	The calling script's handlers are available within the called script.
		2.	The calling script's properties are available within the called script
			as globals. They are available in the called script's run handler
			and within any handler where declared as a global variable
			with 'global propertyName'.

You have used globals in your analysis, too. But, then, you state ...

> [1] Note that the environments provided by ASE and the applet differ slightly, as the latter somehow leaks and allows to call handlers defined in the caller script:

> Frankly, notwithstanding the uncleaness of an object depending on its caller, I wouldn't rely on that "feature" provided by the applet environment.

And I agree that there may be something to worry about, here. My reading of ASLG reveals that 'load script' is intended to be used as ...

	set handlerLibrary to load script aliasToScriptFile

so that its handlers can be called using ...

	tell handlerLibrary to set x to handlerName(...)

The writers of ASLG seem not to have even considered use of ...

	run (load script aliasToScriptFile)

and do not discuss inheritance with this usage or any other usage of 'load script ...'.
We seem to be in undocumented territory.

I would like to see some documentation on this because I'm afraid that one day AppleScript will be changed so that properties are inherited "properly" and 'global' will no longer be required. In other words, MY DOCUMENTATION will no longer be valid.

 _______________________________________________
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: 
 >Re: Load Script (From: Luther Fuller <email@hidden>)
 >Re: Load Script (From: Axel Luttgens <email@hidden>)

  • Prev by Date: Re: Talking to apps running under different users' accounts on same machine?
  • Next by Date: Re: For some strange reason
  • Previous by thread: Re: Load Script
  • Next by thread: Re: Load Script
  • Index(es):
    • Date
    • Thread