Globals and namespaces for Rev.

Dennis Brown see3d at writeme.com
Mon Jun 13 11:49:13 EDT 2005


I am not familiar with namespaces in other languages, but having just  
become aware that globals in anyones different project stacks (that I  
happen to load into DreamCard at the same time) can interfere with  
each other --I am appalled!

I don't want to have to come up with a new name for the same function  
global in unrelated stacks that I might want to run at the same time,  
or worry about how someone else named theirs.

It is a matter of scope.  I can see how this came about, but it just  
wrong and needs to be addressed in an elegant way.

local variables to an object are persistent, but can only be accessed  
in the script of that object.  What if we could specify any objects  
script locals to be included in this scripts locals?   That way you  
could just state: local using "mySemiGlobalRepositoryObject" and all  
the locals there would be shared in this script, but no others -- 
unless declared.  I would also prefer that I did not have to re- 
declare just the ones I am using in this script again --just make  
them all available.  However, when declaring a duplicate local name,  
the declared local superceedes the "semiGlobal".

Would anyone vote for such an enhancement?

Dennis

On Jun 13, 2005, at 12:06 AM, Ruslan Zasukhin wrote:

> Simple var name conflict -- this is HUGE PROBLEM, which did exist  
> in the C
> language for example for years.
>
> Even C++ language did have it about 10 years. Until namepaces was  
> invented.
>
> Namespace -- is very simple conception, yet very powerful.
> * we use namespaces everywhere in C++ sources of Valentina and we  
> enjoy
>    by this.
>
> * btw, I can tell from my experience, that namepsaces allow you  
> split task
> into separate modules. And HELP you keep that modules isolated. So you
> explicitly see where modules depend each on other.
>
> In the C++ books namespace is pointed as even more strict structure  
> than
> classes. Revolution do not have classes now. Do not know if it will  
> have
> ever. But Namespace is feature which CAN BE EASY ENOUGH be added to
> language.
>
> Note, that developer is NOT forced to use it.
> Assume Revolution 3.0 have namespace...You still can just NOT use  
> them.
> Other developer may add namespace to own stack and be happy.
>
> I think this is good idea add this as feature request.


More information about the use-livecode mailing list