• 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
bug or feature?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug or feature?


  • Subject: bug or feature?
  • From: "Donald S. Hall" <email@hidden>
  • Date: Wed, 17 Oct 2001 21:07:46 -0600

hi all,

I was under the impression that global variables were not persistent from
run to run, only properties were. I was surprised to discover that global
variables seem in fact to also be persistent. You can see this by running
the following as an applet (Classic or OS X).

-------------------------------------------------------------------------
global x

try
class of x
display dialog (("Class of x is " & class of x as string) & return & ,
"Value of x is: " & x as string) & return & "No error"
on error
set x to "This is a test."
display dialog (("Class of x is " & class of x as string) & return & ,
"Value of x is: " & x as string) & return & "In error block"
end try
-------------------------------------------------------------------------

First run result:

display dialog "Class of x is string
Value of x is: This is a test.
In error block"

Second run result:

display dialog "Class of x is string
Value of x is: This is a test.
No error"

I get the same result with OS 9.2.1 (AS 1.6) or OS 10.1 (AS 1.7). The value
of x is remembered between runs. I wanted to use the fact that 'x' was
undefined to determine if my applet was already running when its open
handler was invoked by drag and drop.

Any comments?

Don
--
Donald S. Hall, Ph.D.
Apps & More Software Design, Inc.
http://www.theboss.net/appsmore
email@hidden


  • Follow-Ups:
    • Re: bug or feature?
      • From: Chris Nebel <email@hidden>
    • Re: bug or feature?
      • From: Jon Pugh <email@hidden>
  • Prev by Date: Converting an applescript from 68k to PPC?
  • Next by Date: Re: bug or feature?
  • Previous by thread: Converting an applescript from 68k to PPC?
  • Next by thread: Re: bug or feature?
  • Index(es):
    • Date
    • Thread