• 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: Before I forget
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Before I forget


  • Subject: Re: Before I forget
  • From: Christopher Nebel <email@hidden>
  • Date: Tue, 18 Mar 2008 21:24:05 -0700

On Mar 16, 2008, at 1:04 PM, deivy petrescu wrote:

The Guide mentions constant, I remember being brought up that constants are not very constants in AS.
For instance
set pi to 3
makes pi=3!!!
But I was not aware that one could set other constants as well

The new Guide is less unclear on the meaning of "constant" than the old one, but you have to read rather carefully. I assume you're referring to the Global Constants in AppleScript section -- if you look, you'll notice that it says that "AppleScript" is a constant referring to a script object with a variety of properties, which are all writable. In other words, "AppleScript" itself is a constant -- you can't set it to something else. That doesn't mean that the object it refers to is a constant, however. If you're familiar with modern C, this is similar to the distinction between "const T *" (a mutable pointer to a constant T) and "T * const" (a constant pointer to a mutable T).


Another point, even when using "local" declaration, the variable is kept on the script. Which is kind of weird considering the example I posted. The following

set mypasswd to "bomdia"

will show "bomdia" on your script whether it is declared as local or not.
That is save the script above and open it in TextEdit. "bomdia" will be clearly readable.


This differs than what I'd expect using "local".

You're assuming that that value is stored in the local variable. It isn't. You're looking at the value of "result" global, which, as a global variable, is archived.



--Chris Nebel AppleScript Engineering

_______________________________________________
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: Before I forget
      • From: deivy petrescu <email@hidden>
References: 
 >Before I forget (From: deivy petrescu <email@hidden>)
 >Re: Before I forget (From: Axel Luttgens <email@hidden>)
 >Re: Before I forget (From: deivy petrescu <email@hidden>)

  • Prev by Date: Re: Which version of InDesign created a document?
  • Next by Date: Re: Toxic Soup and Enough for all
  • Previous by thread: Re: Before I forget
  • Next by thread: Re: Before I forget
  • Index(es):
    • Date
    • Thread