Re: inheritance
Re: inheritance
- Subject: Re: inheritance
- From: julifos <email@hidden>
- Date: Thu, 15 Jan 2004 11:40:35 +0100
>
Shouldn't a loaded script object inherit everything from the main script into
>
which it was loaded.
No. It is a new instance of a script object with its own methods,
properties, etc.
>
In other words shouldn't handlers within the loaded
>
script object be able to see (and change the value of) variables declared as
>
global in the main script? make use of handlers defined in the body of the
>
main script? Or do I have to explicitly declare the main script as the parent
>
of the loaded script object in order to inherit these things? If so, how does
>
one refer to the top level script?
You must explicitly call "my parent". Eg:
#################### loaded script
to doIt()
set my parent's z to 4
end doIt
####################
#################### loader
property z : 3
set m to (load script alias "path:to:loaded")
m's doIt()
z --> 4
####################
If you use "set z to 4" in the doIt() handler, z won't be modified in the
"main" script.
jj
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.