• 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: Ehsan Saffari <email@hidden>
  • Date: Sat, 7 Apr 2001 13:32:22 -0600

On 07/04/2001 12:39, John W Baxter <email@hidden>, wrote:

>>At 4:31 -0600 4/7/01, Ehsan Saffari wrote:
>>So would the use of a property instead of a global be the answer,
>>initialized at the start of each run?
>
>No...properties are essentially globals which are given an initial value at
>compile time, when used in the main script. The problem with globals isn't
>that running a different script concurrently could trample on them but that
>they don't scale well to large scripts (or large programs):

So their asset turns out to be their liability?

>it is too easy for the script writer to get confused. A script editor which
>supports multiple panes would help.

So is it bad to use a global if one is using SE, but OK in SD (or others?)

>Global doesn't mean "every script can see it" but rather "everything in
>this script can see it."

Thank you for the correction. And I thought that was the point of using a
global, so a value can be set a retrieved anywhere else in the script.
This sounds like "We use a match to light a fire but we shouldn't use
matches because they may cause a fire"

>John (who has removed an erroneous assertion and a wonderful example
>purporting to demonstrate it....whew!)

And thank you for doing so, appreciate it.

cheers
ehsan


  • Prev by Date: Re: Globals are considered harmful
  • Next by Date: Re: Path to a file
  • Previous by thread: Re: Globals are considered harmful (was Re: Recursion script which doesn't?)
  • Next by thread: Re: Globals are considered harmful (was Re: Recursion script which doesn't?)
  • Index(es):
    • Date
    • Thread