Stack with the same name loop

Mark Waddingham mark at livecode.com
Thu Oct 7 11:16:51 EDT 2021


On 2021-10-07 15:57, Brian Milby via use-livecode wrote:
> Clone stack avoids the check.  It is not that hard to get multiple
> stacks with the same short name but different long names in memory (in
> a standalone).  The engine makes sane choices when referencing the top
> stack in that case.  Any individual stack can be referenced via the
> long name.

Yes indeed, you don't actually need to even use clone stack - just 'set 
the name of' will do it.

However, the fact you can do that from script is a different case from 
what the IDE should let you do in the normal course of things (and 
indeed, perhaps we should plug the holes in the engine which let it 
happen) in (a perhaps vain?) attempt to stop people tying themselves 
into too many knots.

Things like the 'topStack' and 'defaultStack' are only sane references 
to the actual underlying stack if they are used as direct syntax (where 
they resolve to the internal pointer). As soon as they are rendered to a 
string (e.g. when passed as an argument) that link is gone - further, if 
a stack has not been saved then there is no way to distinguish one from 
the other with any string-based reference (a stack's long id is only 
different from its name / long name if it has a filename).

Warmest Regards,

Mark.

-- 
Mark Waddingham ~ mark at livecode.com ~ http://www.livecode.com/
LiveCode: Everyone can create apps




More information about the use-livecode mailing list