3 ms·
Also, don’t use automatic module init, make the user call an init function at startup. And prefix everything in your library with a unique string.
by lokar 1y ago
Also, don’t use automatic module init, make the user call an init function at startup.
And prefix everything in your library with a unique string.
- layer8 1y agoWhat if you use two libraries A and B that both happen to use library C under the hood? Is the application expected to initialize all dependencies in the right order at the top level? Or is library initialization supposed to be idempotent? This all works as long as libraries are “flat”, but doesn’t scale very well once libraries are built on top of each other and want to hide implementation details.
- eyalitki 1y agoAgree, there should be a prefix. But if 2 of my dependencies didn't use a prefix, why is it my fault when I fail to link against them? Also, some managers object to a prefix within non-api functions, and frankly I can understand them.