Interoperability -- Same Name Substacks

J. Landman Gay jacque at hyperactivesw.com
Thu Feb 23 14:26:38 EST 2006


Sivakatirswami wrote:

> Assumption: only the IDE, and related plugins get unhappy with same  
> named substacks open at the same time.
> 
> It's an important question, considering the kinds of corruption and  
> data loss envisioned if that assumption is wrong.

I think the assumption is wrong, unfortunately. The engine will happily 
open same-stack names in any environment. The Rev IDE protects you from 
problems by not allowing you to open a same-named stack. Your own 
application, not having the same layer of protection, will open a 
same-named stack without complaint. If you then try to save data to one 
of the stacks, you won't know which copy is being updated. It will be a 
crap shoot.

If you plan to open same-named stacks in your standalone, then you must 
protect the data yourself, just as the IDE tries to do for you. You can 
do that by making sure that you always use long stack references when 
you are writing to or saving a stack. For example:

   put myText into fld 1 of stack "prefs" of stack "MainA"

This will point the engine to the correct "prefs" stack if there are 
currently several of them open.

You can also parse the "long name" of the stack before writing data to 
it, to make sure you are working with the correct copy.

-- 
Jacqueline Landman Gay         |     jacque at hyperactivesw.com
HyperActive Software           |     http://www.hyperactivesw.com



More information about the use-livecode mailing list