Best Practice for Library Stacks

Paul Dupuis paul at researchware.com
Thu Feb 13 09:03:41 EST 2014


You can have more Library stacks loaded (via start using) than you can
insert back scripts or front scripts. The numbers used to be 50 library
stacks and 15 front and 15 back scripts. I am not sure if that has
changed with recent releases. This may or may not make a difference for
you depending upon how large your libraries grow and whether you want to
break them up into multiple libraries

Using a convention I first saw Richard Gaskin use, you can organize
handlers within a script by using "empty handlers" as dividers. For example:

on __MATH_ROUTINES__
  # These are my math routines all collected together
end __MATH_ROUTINES__

function calcSum pX, pY
   return pX + pY
end function

function kinetic pM, pV
   return 0.5 * pM * pV^2
end function

on __USERINTERFACE_ROUTINES__
  # These are my math routines all collected together
end __USERINTERFACE_ROUTINES__

on answerSum
   answer calcSum(3, 5)
end answerSum

This provides for very visible section breaks in the list of scripts in the IDE between collections of handlers. There is of course nothing special about starting the handler names with underscore, it is really just to provide a visible difference from other handlers.





More information about the use-livecode mailing list