Overcoming the infamous {Public symbol is declared in another module: V_EMPTY}
Today's tip is a guest tip from Alain Romedenne (aromedenne at amadeus dot net). Alain is heavily involved with the OpenDOM and NSFPeek projects at OpenNTF.org, and wanted to share some of his wisdom with the Breaking Par readers. Thanks, Alain! Including *.lss files is one of Notes Designers' nightmares. Indeed, numerous developers gave up practicing %Include "LsConst.lss" or other libraries. Most of them redefine private constants in their libraries, forms or views, which unfortunately isn't a good programming habit.
A good thing would be to define LotusScript global constants within an .lsx file and have them accessible from Notes Domino IDE. But IBM/Lotus apparently didn't see it this way !
Up to now, my solution is to create a "LsConst" LotusScript library for reference into applications' design. This library's constants are neither declared public, nor declared private AND "LsConst" library starts with Option Public. Application Libraries, forms or views performing Use "LsConst" can equally contain Option Private | Public and/or Option Explicit | Declare; although Option Declare in libraries is considered a best practice.
Pros:
- One can reference "LsConst" CONCURRENTLY in libraries, forms, views, thus achieving COMPLETE reusability.
- Constants in nested libraries ARE reachable e.g. I can reference LSI_THREAD_CALLPROC constant in my code coding Use "LsConst" while "LsPrcVal" library is nested within "LsConst" library.
- LotusScript libraries' size is reduced (both source and object codes) when referencing "LsConst" as described previously.
- No compiler Option are imposed to programmers.
- Promoting "LsConst" library to production environments isn't required (except in rare cases where LotusScript libraries get loaded dynamically...)
Cons:
- Version upgrades from R4 to R5, R5 to R6 require some attention for libraries cloned from Lsconst.lss, lserr.lss Domino files.
your remarks are welcome...
One can check OpenDOM project at www.openntf.org where "LotusScript.exceptions" and "LotusScript.lang.Lscont" libraries exploit this mechanism.