Search code examples
lotus-noteslotus-dominolotusscript

Lotusscript Libraries and DRY


I created a set of Lotusscript libraries for the purpose of reusing it in other Domino applications.

I tried to refactor and take all Const declarations (for custom errors) in all libaries and put it in a new library named CustomErrors. Error numbers declared here are intended to be generic (e.g. PARAM_IS_NOTHING, DATABASE_NOT_FOUND, etc.) so that I could Use it for all the libraries in the set.

The problem is, when a client code references 2 libraries that use the CustomErrors library, a "Public symbol is declared in another module" error shows up.

Here's my question: is there a way to structure Lotusscript libraries so that we can achieve some form of reusability?


Solution

  • If you have two separate libraries (tom and jerry, say) that both reference one library 'Custom Errors', and your code (in a form, say) is referring to both tom and jerry, then there should not be an error.

    Sometimes Notes gets confused as to the order of script libraries. Your first friend is 'Tools/Recompile all LotusScript'.

    If that doesn't work and you have Teamstudio Configurator, run a change of Use " into use " (which will ensure that all script libraries with dependancies will get recompiled). Sadly, the third-party tool recompiles better than the IBM ones.

    As a last, brachial resort, It's well worth re-creating the two libraries that are causing you troubles.

    rename tom to tom_old renname jerry to jerry_old

    create from scratch two new scriptlibraries called tom and jerry

    paste the content from tom_old into tom (mutatis mutandis for jerry)

    (This is assuming you have looked into tom and jerry for any constant which is possibly doubled)