On Jul 7, 2009, at 9:48 AM, Michelle Steiner wrote:
On Jul 7, 2009, at 9:39 AM, Mark J. Reed wrote:
If "foo" is not an active term in the
current context, then "|foo|" refers to the same variable, as do
"Foo", "|fOo|", etc.
Not true
Almost true.
set foo to 1 |Foo| = foo
The result is an alert "The variable |Foo| is not defined.
set foo to 1 set |Foo| to 2 |Foo| = foo
--> false
1. User terminology is case-insensitive, but case-preserving.
2. Vertical bars may be used to "escape" user terms that contain illegal characters or collide with other terms, or where you wish to control the case when sending/receiving user terms to/from applications*.
3. As an implementation detail, user terms with vertical bars are currently in a separate namespace. Therefore, "foo" and "|Foo|" name two separate variables; however, do not rely upon this implementation detail remaining true.
* Notice that if you compiled "|foo|" the vertical bars go away. This is because they aren't necessary for all-lowercase user terms. But they remain if you compile "|Foo|", because terms may be treated as data and sent to/from applications. e.g.,
tell application "Finder" to someFunction() tell application "Finder" to get its someFunction
These tell Finder to call a function named "someFunction" and to get a property named "someFunction", respectively. You can send user terms in Apple events, not just application-defined terms. The text "someFunction" is actually sent to the application. The application may or may not treat these as case-insensitive (although it should). Of course, the application has to define some meaning for the terms. The above lines result in errors, since Finder doesn't define anything named "someFunction".
-- Chris Page
The other, other AppleScript Chris
|