lualatex-tools / luaformatters

Creating macros for LuaLaTeX packages
GNU General Public License v3.0
0 stars 0 forks source link

Singleton instance or individual instances? #14

Closed uliska closed 5 years ago

uliska commented 5 years ago

It should be thought about the question whether all clients (a document and possibly multiple packages) should share one Templates instance or if they should have their own instances each. The current implementation supports the latter.

One advantage of sharing an instance would be that namespace collisions could be handled more gracefully than with simply producing the LaTeX "already defined" error.

A disadvantage is that it would require more management overhead, that not only the namespace for LaTeX macros would be affected but also the internal table namespace (a helper function with the same name would silently overwrite one that has been defined by an earlier client. Additionally it would not be possible to have different options settings for the various packages.

Thinking about it, the disadvantages seem totally outweighing the advantages here. Maybe it's possible then to have the main template keep track of its child instances and detect name clashes. (And BTW: it is perfectly possible to have formatters stored in the same place in different trees but expose them with different macro names.)

This is related to #12

uliska commented 5 years ago

Obsolete