Re: Globals are considered harmful
Re: Globals are considered harmful
- Subject: Re: Globals are considered harmful
- From: Doug McNutt <email@hidden>
- Date: Sat, 7 Apr 2001 18:46:46 -0600
>
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.
There is an interesting problem with calling AppleScripts from within a MacPerl script operating as an MPW tool. MPW crashes badly whenever an AppleScript is called while executing a perl script a second time without quitting and restarting MPW. It has been explained that the failure is caused by AppleScript caching features from the first call and expecting them to be in application memory on subsequent calls. Of course they aren't because MPW cleans up after its tools. Somehow AppleScript remembers things until an exit-to-shell system call is executed.
Are you quite sure that AppleScript isn't capable of caching globals? If not just what is it caching that causes the crashing? Does one get the same system code when asking MacPerl or MPW to execute an AppleScript in the form of text as he does when using the script editor or executing a compiled script from the finder?
--
-> From the U S of A, the only socialist country that refuses to admit it. <-