Suchen / SearchNavigation |
Experiments about the Scope of AppleScript Variables and Properties5 Nov 2010 - 15:29 I am not really happy with the chapter on the scope of variables and properties in the AppleScript manual. The authors tried to keep things simple, but they tried too much: Some questions are left open and may well turn into traps if you write code. I tried to write this article comprehensible on different levels. But parts the topic is advanced stuff for scripting. A note of caution: This article is based on some experiments I describe. Such experiments have a limited reliability: I develop a model in my mind, try to find some code testing that model and note the result. But that way, models can only be falsified, than I tried to find a new, consistent one. But there never is real proof. If a result is consistent with my model, it may still be consistent with some other contradicting model. Possibly I did not find the proper test for the distinction. I am sure that most you will find some things about variables and properties you did not know before. But this is no definite documentation. Experiments can not prove that a model is right, but they can prove that something is wrong. Most descriptions I found in the Web about variables and properties are not consistent with all code examples given here. Even if I made some mistake somewhere, this should still provide useful corrections to simpler models. At first, I try to make as clear as possible two basic concepts: a) what is the top level of a script and b) what is a script. The other pages discuss the scope of properties and variables, where in a script they are defined and valid. Afterwards I discuss for variables and properties how long they live.
|
Experiments about the Scope of AppleScript Variables and Properties |