Re: Library settings, best practices?

2018-12-10 Thread Vladimirs Nordholm via Digitalmars-d-learn
On Saturday, 8 December 2018 at 17:05:50 UTC, Adam D. Ruppe wrote: Alternatively, you could perhaps have it keep an internal is_initialized flag and lazily call init on your other function calls if it is not already done. Then if the user wants to customize settings, they just call init before

Re: Library settings, best practices?

2018-12-08 Thread Adam D. Ruppe via Digitalmars-d-learn
On Saturday, 8 December 2018 at 16:58:24 UTC, Vladimirs Nordholm wrote: Is there a best practice to enabling specific parts of a library? For my terminal library, I put it all in a struct. Then the user gets to choose how to initialize it, and its destructor gets a chance to cleanup when

Library settings, best practices?

2018-12-08 Thread Vladimirs Nordholm via Digitalmars-d-learn
Hello. Pre-rant: - I have a library to aid in development for the terminal. This library has to initialize some things before it can be used, and I run some code in `shared static this(){...}`. I believe in the most common case scenario my initializer should be run. The initializer