Standalone compile never leaves closing open stacks

LiveCode is the premier environment for creating multi-platform solutions for all major operating systems - Windows, Mac OS X, Linux, the Web, Server environments and Mobile platforms. Brand new to LiveCode? Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7215
Joined: Sat Apr 08, 2006 8:31 pm
Location: Minneapolis MN
Contact:

Re: Standalone compile never leaves closing open stacks

Post by jacque » Wed Nov 18, 2020 10:33 pm

It was an intentional change so there's no reason to send a report to LC. There was a discussion on the mailing list about it, here is what I saved:
The standalone builder has always needed to close the stacks it builds for reasons pretty deeply ingrained in the code. However this causes a few problems, for example:
values in script locals become empty
behaviors are broken when the parent script is on / in a stack which closes

As an attempt to improve this situation, the code that locks messages when closing and opening stacks for standalone builds has been removed. This means that where previously mainstacks would not receive openStack and closeStack messages during standalone build, they now do.

If this causes problems for your stack, you can exit from the handler if standalone building is in progress:

on closeStack
if the environment is "development" AND there is a stack
"revStandaloneProgress" AND the mode of stack
"revStandaloneProgress" > 0 then
exit closeStack
end if
...
...
end closeStack

All stack-related messages need to use this: preOpen*, open*, close*, etc.
So you could write a function:

function isBuildingStandalone
return the environment is "development" AND \
there is a stack "revStandaloneProgress" AND \
the mode of stack "revStandaloneProgress" > 0
end isBuildingStandalone

and then in e.g. the openstack handler:

on openstack
if isBuildingStandalone() then
exit openstack
end if
..
..
end openstack

Similar in all other (pre)open*/close* messages.

Kind regards,
Panos
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

stam
Posts: 2634
Joined: Sun Jun 04, 2006 9:39 pm
Location: London, UK

Re: Standalone compile never leaves closing open stacks

Post by stam » Thu Nov 19, 2020 2:13 am

That's really interesting and good to know - thanks Jacque
Don't think i've seen that in the documentation or as a lesson but it should be!

dr_mumps
Posts: 23
Joined: Wed Dec 24, 2014 7:00 pm

Re: Standalone compile never leaves closing open stacks

Post by dr_mumps » Thu Nov 19, 2020 8:25 pm

Fantastic!!! This solved all of the compile problems I was having ... I'm very happy about now being able to use the latest version of LC. However... one question remains...

If this code is REQUIRED in those sorts of handlers... why leave it to the developer to REMEMBER to specify it when the Standalone compiler SHOULD do automatically. IMHO... one of the characteristics that define a good programmer is that they want to be EXTREMELY lazy ... in that if they can avoid extra steps, that makes their output more efficient. So, naturally, we want the tool to do as much of the grunt work as possible.

Just my 5 cents (inflation) worth ... Thanks everyone for their contributions to this issue. What a great group!

Now if we can get the forum search functionality improved, I'll be in heaven.

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7215
Joined: Sat Apr 08, 2006 8:31 pm
Location: Minneapolis MN
Contact:

Re: Standalone compile never leaves closing open stacks

Post by jacque » Fri Nov 20, 2020 7:54 pm

If this code is REQUIRED in those sorts of handlers... why leave it to the developer to REMEMBER to specify it when the Standalone compiler SHOULD do automatically
I'm not sure how they could do it any other way. When messages were locked there was no problem, but when unlocking messages to fix the problems they listed, the standalone builder no longer has any control. Messages are sent through the message path normally after the SB passes them.

I've built several standalones since the change was made and never needed to employ the fix, so it does depend on what the handlers do.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

Klaus
Posts: 13806
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: Standalone compile never leaves closing open stacks

Post by Klaus » Fri Nov 20, 2020 8:03 pm

Maybe the mothership could add another "messageless" application which will create the standalone?

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 9802
Joined: Sat Apr 08, 2006 7:05 am
Location: Los Angeles
Contact:

Re: Standalone compile never leaves closing open stacks

Post by FourthWorld » Fri Nov 20, 2020 8:31 pm

Klaus wrote:
Fri Nov 20, 2020 8:03 pm
Maybe the mothership could add another "messageless" application which will create the standalone?
^ this

In MC building a standalone was not a disruptive process. It shouldn't be in LC either, and certainly shouldn't require modifying code just to build.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

Post Reply

Return to “Getting Started with LiveCode - Experienced Developers”