defining and using globals in an application

Bob Sneidar bobs at twft.com
Thu Jul 7 11:55:17 EDT 2011


I think you are saying there ought to be something called a stack global, that if declared there outside any script, will be available without declaring it in any of the substacks scripts. Yes? 

The reason they do things the way they do is so that you do not accidentally reference a global that was declared in some other app you are building. Let's say you have an accounting stack, and you have an address book stack. You decide to incorporate the address book stack into your accounting app instead of building a customer stack from scratch. 

In the stack script of both you have a global called vDatabase, which contains the name of the database where the data is hosted. Without this kind of scoping of variables, you could never be sure that they didn't get confused. 

Bob


On Jul 6, 2011, at 8:29 PM, Mark Stuart wrote:

> Hi Slava,
> 
> My point exactly.
> You have to define it again in every stack, or substack you want to use the
> value thereof.
> I define my globals at the top of each stack, outside any script. But only
> those globals I need in that stack.
> 
> I think it is unnatural to call it a "global" and the value of that global
> not be available anywhere else (in other stacks), unless you define that
> global again.
> 
> This sets up the scenario of typing the global names incorrectly, or missing
> to define it where needed.
> 
> Regards,
> Mark Stuart
> 
> 
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode





More information about the use-livecode mailing list