I would be more of a fan of lowering the engine check to just a warning vice a hard error/prohibition. Like you said, if you don’t use the long name then most of the time you are going to reference the earliest opened version of the stack (based on the linked list of open stacks). But if you reference an object within the same stack (or at least the visible card), it can reference by short name. I guess I should expand my test stack to check that.
I can see a couple of ways to implement this where it would not impact existing code. First would be a global flag to enable opening of files with the same name (default to off/false). The second would be a “force” parameter to the open command which would bypass the check. Sent from my iPhone > On Oct 7, 2021, at 11:17 AM, Mark Waddingham via use-livecode > <[email protected]> wrote: > > 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 ~ [email protected] ~ http://www.livecode.com/ > LiveCode: Everyone can create apps > > _______________________________________________ > use-livecode mailing list > [email protected] > Please visit this url to subscribe, unsubscribe and manage your subscription > preferences: > http://lists.runrev.com/mailman/listinfo/use-livecode _______________________________________________ use-livecode mailing list [email protected] Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
