Modularising Code

Earthednet-wp prothero at earthednet.org
Thu May 8 22:22:25 CEST 2014


Thanks for the reference to Richard's page! Excellent! It clarified some items I've had on my mind.

Btw, Dar's post suggests to me that one could create an infinite loop if there was a script in the substack that passed a message, then a script with the same name in the main stack also passed the message, then back to substack, ad infinitude. A reasonable scenario would be a mouseup handler.

Bill

William Prothero
http://es.earthednet.org

> On May 8, 2014, at 12:10 PM, Peter Haworth <pete at lcsql.com> wrote:
> 
> I'd also recommend Richard Gaskin's excellent article on the subject which
> can be found at
> http://www.fourthworld.com/embassy/articles/revolution_message_path.html
> 
> Pete
> lcSQL Software <http://www.lcsql.com>
> Home of lcStackBrowser <http://www.lcsql.com/lcstackbrowser.html> and
> SQLiteAdmin <http://www.lcsql.com/sqliteadmin.html>
> 
> 
> On Thu, May 8, 2014 at 11:20 AM, Mike Kerner <MikeKerner at roadrunner.com>wrote:
> 
>> Terry,
>> Definitely use substacks to modularize your code, BUT, I would suggest you
>> do just a wee bit of reading on the message path, because it's important
>> for everyone, and all of the questions you asked are discussed there:
>> 1) In the LC toolbar at the top, the second-to right button is "Resources".
>> Click it
>> 2) The second link down is the "User Guide".  Click it
>> 3) Inside there search for "message path".  There is a whole discussion of
>> what it is and how to use it.
>> 4) SEND and PASS and START USING STACK are your friends.
>> 
>> 
>> 
>> 
>> On Thu, May 8, 2014 at 11:57 AM, Terence Heaford
>> <t.heaford at btinternet.com>wrote:
>> 
>>> 
>>> My understanding is if you create a library of a stack it’s stack script
>>> is placed between the main stack that has called start using and
>> LiveCode’s
>>> engine.
>>> 
>>> Is that correct?
>>> 
>>> If yes then I presume if you start using a substack then the substack
>>> script is placed between the main stack that has called start using and
>>> LiveCode’s engine
>>> 
>>> Is that correct?
>>> 
>>> If you only have handlers in the stack script of the substack then any
>>> messages will only call them after passing through the mainstacks script.
>>> 
>>> Is that correct?
>>> 
>>> If you actually use the substack as more than a repository for scripts
>>> then any control will pass the message through the substacks script to
>>> mainstack and onto the substack again.
>>> 
>>> Is that correct or once you start using the substack is it removed from
>>> the normal message passing and any control only passes to the substack
>>> script and onto the engine?
>>> 
>>> I hope the above is understandable.
>>> 
>>> All the best
>>> 
>>> Terry
>>> 
>>> 
>>>> On 8 May 2014, at 14:37, Dar Scott <dsc at swcp.com> wrote:
>>>> 
>>>> Remember that the main stack is in the message path of the substack.
>>> So, you will have the main stack twice in the message path for cards and
>>> controls.  This is probably fine.  But, something like a keystroke
>> counter
>>> in the main stack might count them twice.
>>> 
>>> _______________________________________________
>>> use-livecode mailing list
>>> use-livecode at lists.runrev.com
>>> Please visit this url to subscribe, unsubscribe and manage your
>>> subscription preferences:
>>> http://lists.runrev.com/mailman/listinfo/use-livecode
>> 
>> 
>> 
>> --
>> On the first day, God created the heavens and the Earth
>> On the second day, God created the oceans.
>> On the third day, God put the animals on hold for a few hours,
>>   and did a little diving.
>> And God said, "This is good."
>> _______________________________________________
>> use-livecode mailing list
>> use-livecode at lists.runrev.com
>> Please visit this url to subscribe, unsubscribe and manage your
>> subscription preferences:
>> http://lists.runrev.com/mailman/listinfo/use-livecode
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode



More information about the use-livecode mailing list