• 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: Globals are considered harmful (was Re: Recursion script which doesn't?)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Globals are considered harmful (was Re: Recursion script which doesn't?)


  • Subject: Re: Globals are considered harmful (was Re: Recursion script which doesn't?)
  • From: "Serge Belleudy-d'Espinose" <email@hidden>
  • Date: Sun, 8 Apr 2001 11:40:42 +0200

At 10:35 -0700 7/04/01, Paul Berkowitz wrote:

>The thing is: although theoretically persistent, globals have to be set to
>be used, otherwise they error as undefined variables. So the next time you
>run the script, they are automatically reset to the original setting, and
>are thus effectively not persistent. You can't even start out
>
> if someGlobal  "" then
> --do something
> else
> set someGlobal to something
> end if

Coincidentally, I just found that you can use this in a script:

try
set myVar to ... -- anything you want with myVar, such as myVar + 1

on error
set myVar to ... -- initial value

end

What's the point of using this?
- a property is persistent and global
- a global isn't persistent but... global
- myVar is not global, but persistent anyway

I think myVar fills a gap between properties and globals.
I'm pretty confident others have found this also. But as this "discovery" is new to me, I just wanted to share it.


Serge
--
\\//\//\// Serge Belleudy-d'Espinose Institut Jacques Monod
// // // http://www.ijm.jussieu.fr/ Univ. Jussieu - Paris
//\//\//\\


References: 
 >Re: Globals are considered harmful (was Re: Recursion script which doesn't?) (From: Paul Berkowitz <email@hidden>)

  • Prev by Date: Re: Stable, CPU-friendly periodic task scheduling
  • Next by Date: Re: Stable, CPU-friendly periodic task scheduling
  • Previous by thread: Re: Globals are considered harmful
  • Next by thread: Re: Globals are considered harmful (was Re: Recursion script which doesn't?)
  • Index(es):
    • Date
    • Thread