Re: Inheritance
Re: Inheritance
- Subject: Re: Inheritance
- From: "Wallace, William" <email@hidden>
- Date: Fri, 23 Jan 2004 17:55:44 -0600
- Thread-topic: Re: Inheritance
>
>a script object could not set the value of a global variable
>
> unless it was both declared as global AND initialized to an arbitrary value in
>
> the top level of the main script. You touch on this in your example 21, but
>
> I'd like to understand the logic behind this behavior better.
>
>
The global doesn't exist until its value is set. If it is only declared,
>
AppleScript knows it's (going to be) a global, but can't find it, and is
>
unwilling to create it merely because the script object wants to set it to
>
something.
>
>
--John (I think) Baxter
Yeah, I see that now, but I'm still wondering (and I realize I'm kind of harping on this) what is the design strategy behind this behavior? Why is Applescript unwilling to create the global at the request of the child script object? What harm could it do?
For instance, what if the CEO of my company announced that a centralized repository was to be created in the office for all employees of the company to store paperclips so that any employee who needed a paperclip at any given time could retrieve one. Does it make more sense that no employee could get any paperclips from this repository until the CEO had first ponied up with the paperclips or does it make more sense that as soon as _anybody_ came forward with a supply of paperclips, then there would be paperclips available in the central repository?
I guess maybe Applescript is a little more optimistic about CEOs. Maybe Steve Jobs is the kind of guy who would first gather all the paperclips and then declare "I will now create a central repository of paperclips for all to share!" But to my thinking that is a property; A global that is declared with an initial value.
To my thinking declaring a global variable at the top level but not giving it any initial value is like saying "Okay, I made this box... anybody who wants to put something in it can now do so."
Or is it more like this... The declaration of the global variable is the CEO's announcement of a new policy idea, but it's not worth spit until the CEO's administrative assistant filters out all the half-assed, hair-brained schemes that the fearless leader hatches until a really worthwhile idea surfaces and then the adminsitrative assistant actually implements the new idea making it actually available to everyone?
I'm just trying to understand this idea as fully as I can. I prefer to anchor things in my head to basic principals or ideas. It helps me remember how things work if I know why they were designed that way.
Anyway,
B!ll
_______________________________________________
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.