[futurebasic] Re: [FB] DIMs and LOCAL FNs

Message: < previous - next > : Reply : Subscribe : Cleanse
Home   : April 2000 : Group Archive : Group : All Groups

From: "Dr. Steven J. Stratford" <sstratford@...>
Date: Sun, 09 Apr 2000 09:07:23 -0500
On 4/3/00 5:14 PM, Robin at robinc@... wrote:

>> 2.  If the Vars are "outside"/"before" the LOCAL FN, then they become
>> quasi-global vars for "everything" that follows - even beyond the
>> LOCAL FN, a form of "static" variable that lives on - even after the
>> Function has done its thing, but only for those Functions that follow
>> it. If you do this at the very beginning of a file, then the var is
>> global for that file. Do it at the beginning of the Main File and the
>> var is global for the entire project.
>> 

So here's a sample snippet:

DIM globalVar%
END GLOBALS

DIM quasiVar%'here's a quasi-global

LOCAL FN aSubFunction
PRINT quasiVar%'available here?
END FN

LOCAL FN aMainFunction
quasiVar% = 1'available here?
FN aSubFunction
END FN

'MAIN
PRINT quasiVar%'Undefined here?
DO
UNTIL mouse(_down)
END

According to what was said, shouldn't quasiVar% be available to aSubFunction
and aMainFunction? Compiler (release 1) complains that quasiVar% is not
DIMmed in the two functions.

What I'd love to figure out is how to make some vars quasi-globally
available to the two functions but unavailable to MAIN. That would save me a
heap of variable passing in my CGI function calls involving threads that
need completely separate variable contexts (but access to some normal
globals, too, of course).

--Steve

_____________________________
Steven J. Stratford, InterNetyx.com
Supercharge your website!
www.internetyx.com
920-206-9197
_____________________________