Path: utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!cs.utexas.edu!uunet!murtoa.cs.mu.oz.au!munnari.oz.au!uniwa!vaxa!a_dent From: a_dent@vaxa.uwa.oz (Andy Dent, ph: 09 380 2620) Newsgroups: comp.sys.mac.programmer Subject: LSP variable persistence in CODE resource Message-ID: <384@vaxa.uwa.oz> Date: 26 Jun 89 12:06:37 GMT Organization: University of Western Australia Lines: 21 A question came up recently whilst using THINK Pascal (LSP v2.01) to create a pure CODE resource (for a Quickmail bridge). Namely, what is the exact persistence of local variables in the "main" procedure? In this environment (as for most CODE resources) there is no main program but rather a procedure or function that fulfills a similar purpose and which lexically encloses the definitions of all other procedures. Whilst THINK Pascal does some fancy shuffling to give you "global" variables for Desk Accessories and other types of CODE resources, it fails to do so for "pure" CODE resources. I have seen evidence that the local variables of the "main" procedure do retain their values (between calls to the procedure) but I'm not sure if this is guaranteed. Possibly, the only governing factor is the set of attributes given to the resource (eg: not-purgeable,locked) but I have a suspicion that different types of variables may vary in their behaviour. Any comments?