• 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: Vertical Bars disappear for lowercase variable names?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Vertical Bars disappear for lowercase variable names?


  • Subject: Re: Vertical Bars disappear for lowercase variable names?
  • From: Chris Page <email@hidden>
  • Date: Wed, 08 Jul 2009 16:32:19 -0700

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

 _______________________________________________
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

  • Follow-Ups:
    • RE: Vertical Bars disappear for lowercase variable names?
      • From: Jeffrey Weston <email@hidden>
References: 
 >Vertical Bars disappear for lowercase variable names? (From: Jeffrey Weston <email@hidden>)
 >Re: Vertical Bars disappear for lowercase variable names? (From: "Mark J. Reed" <email@hidden>)
 >Re: Vertical Bars disappear for lowercase variable names? (From: Michelle Steiner <email@hidden>)

  • Prev by Date: Re: do script when scripting terminal - solved
  • Next by Date: Re: Reporting bugs (was do script when scripting terminal)
  • Previous by thread: RE: Vertical Bars disappear for lowercase variable names?
  • Next by thread: RE: Vertical Bars disappear for lowercase variable names?
  • Index(es):
    • Date
    • Thread