On Aug 1, 2005, at 9:52 PM, [EMAIL PROTECTED] wrote:

Date: Mon, 1 Aug 2005 18:35:30 -0700
From: Mark Wieder <[EMAIL PROTECTED]>
Subject: Re: global problems

Ken-

Monday, August 1, 2005, 5:47:01 PM, you wrote:

(snip)

Globals are for what they say they are. A global declared during
runtime _should_ be available in any open stack. Why would you want to
get rid of it, i.e., that's what they're for. Unless you want to do a
one-time setup to initialize multiple stacks, then destroy it. Of
course you could do the same thing with custom props, but it would be
more awkward.

Maybe I'm missing something about globals here, but since you have to
reference a global explicitly in a script in order to use it, I don't
see why the global should persist if the stack that declared it is
removed from memory.

Because you might have a _system_ of stacks which use the same global

In other words, if I'm foolish enough to declare a "global x" in a
piece of test code, why should that continue to haunt me when I dump
my test stack and then open a completely different stack that happens
to have a "local x" declaration in it? Am I missing something basic?

Maybe. It has to do with where the engine is.

When you are developing, the Rev application is open. It has the MC engine, and it retains the globals.

But if you develop a system of stacks for a built application, similarly, your main stack has the engine and retains the globals, which is normally precisely what you want. That's why you declare globals.

IOW, any script running under the same engine, regardless of which stack, can declare and operate on the same globals until the application is closed. AFAIK, all xTalks work this way.

For example, if you develop an built application GUI front end for an integrated system of stacks, you may very well want to change its settings, yet be consistent throughout all the stacks in that application. One easy way to do that is to declare globals.

When you close the app, i.e., the main stack, which has the engine, closes, and "poof", the globals are gone. Really gone. Opening Rev or any other Rev-built application will not respond to globals declared in the application just closed in this example.

But, to reiterate for clarity, if you are _developing_ in Rev, it has the engine, your 'Main' stack doesn't (until you build). Therefore, globals you declare while Rev is running will remain, can be called from _any_ script in _any_ stack running in the IDE.

At the risk of repeating myself, again, you just need to be aware of how it works, that's all. Whatever Rev thing is running retains the globals declared within it until it is closed.

I hope that sheds a little light on it.

All the best,
Ken N.

_______________________________________________
use-revolution mailing list
[email protected]
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution

Reply via email to