Seeking recommendations / suggestions for use of library stacks.

Andre Garzia andre at andregarzia.com
Thu May 18 22:33:29 EDT 2017


I usually follow Alis approach. I have a separate initialization handler
which I can call repeatedly if needed. The librarystack call just call it
once but if needed I can call it from the messagebox as well.

On the topic of libraries, it is good to follow a "functional programming"
approach where you try not to rely on script local and global variables. If
you library functions need nothing but their own parameters to work on, it
becomes easier to test them and calling them over and over seldon generate
side effects. It is way easier to test (and debug) a function that doesn't
touch anything outside of its own script (as in it processes data and
return data but doesn't cause changes outside itself).



On Tue, May 16, 2017 at 8:34 AM, pink via use-livecode <
use-livecode at lists.runrev.com> wrote:

> what about putting the process into the library stack files themselves?
>
> For example, when I use my CouchDB library I also load fastJSON:
>
> on libraryStack
>      if "couchDBLib" is not among the lines stacksInUse then start using
> stack "couchDBLib"
>      if "fastJSONlib" is not among the lines stacksInUse then start using
> stack "fastJSONlib"
> end libraryStack
>
> on releaseStack
>      if "couchDBLib" is among the lines stacksInUse then stop using stack
> "couchDBLib"
>      if "fastJSONlib" is among the lines stacksInUse then stop using stack
> "fastJSONlib"
> end releaseStack
>
> note that using "is among" and "is not among" is not optional otherwise you
> end up in an infinite loop
>
>
>
> -----
> ---
> Greg (pink) Miller
> mad, pink and dangerous to code
> --
> View this message in context: http://runtime-revolution.
> 278305.n4.nabble.com/Seeking-recommendations-suggestions-
> for-use-of-library-stacks-tp4714836p4714910.html
> Sent from the Revolution - User mailing list archive at Nabble.com.
>
> _______________________________________________
> 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
>



-- 
http://www.andregarzia.com -- All We Do Is Code.
http://fon.nu -- minimalist url shortening service.



More information about the use-livecode mailing list