Re: variables vrs properties
Re: variables vrs properties
- Subject: Re: variables vrs properties
- From: KOENIG Yvan <email@hidden>
- Date: Wed, 5 Jan 2011 17:27:30 +0100
Le 5 janv. 2011 à 16:32, Luther Fuller a écrit :
>
> On Jan 5, 2011, at 9:10 AM, Jim Brandt wrote:
>> What exactly are the advantages/disadvantages to using properties over variables?
>>
>> Property • global within scope
>> • retains value until script is recompiled
>>
>> Variable • global within scope only if declared global
>> • doesn't retain value between executions
>
> I always compile my scripts as application bundles, so these remarks may not apply if you don't.
>
> You can change the value of a property in an AppleScripted application, but probably shouldn't because that makes your application file self-modifying. This is not compatible with codesigning (which I don't yet use).
>
> Global variables are a bad thing for the same reason. Global variables ARE persistent ... they DO retain their value between executions. For this reason, I never use globals.
In my scripts I reset the properties to their original value.
I don't use them to get persistent items but to fasten lists treatment.
Yvan KOENIG (VALLAURIS, France) mercredi 5 janvier 2011 17:27:23
_______________________________________________
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