defining and using globals in an application

Craig Newman dunbarx at aol.com
Mon Mar 25 22:28:41 EDT 2013


Mark.

Globals are loaded somewhere, and retain their value throughout the application. But you do have to declare it wherever it might be used. Are you asking why this is necessary?

This has always been the case, since way, way back.

So in other languages, if you declare and load a global somewhere, you can use it at any time, undeclared, elsewhere? I see your point, and maybe I am just so used to the way it works, I do not find it onerous to have to declare it each script where it will be used. Actually, I find this comforting, that I know what I intend to do in that script.

I suppose you could make use of a custom property, which, though it might take a bit of file path shenanigans to reference throughout the application, can be used as you would like to. This seems like more work, though.

Craig Newman


On Jul 6, 2011, at 10:56 PM, Mark Stuart wrote:

> Hi all,
> 
> To me, once globals are defined and put with a value, their value should be
> available from any stack within the application.
> 
> So far, so good.
> 
> But the problem arises where, within other stacks script, if you don't
> define the required global again, the desired value is not there.
> 
> The result is the name of the global in the stack where that global was
> first defined.
> 
> Not good.
> 
> 
> 
> So why aren't the values of global's, global to the application?
> 
> In other software development languages, this IS the case.
> 
> Wouldn't you want the same in LC? I would.
> 
> 
> 
> Why isn't this the case in LC?
> 
> 
> 
> 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