>>14
Singletons are a way to share global state among a family of functions
Global variables are the way to share state between a family of functions. You're still thinking in OOP for a set of functions that clearly do not behave this way.
You think global variables are a worse solution? I've got news for you: your singleton IS a global variable. Shocking! I also find it hilarious that you think halting all threads and invoking the class loader is less wasteful than just checking for a damn instance. Besides, the best solution, that is forcing the user to call init(), is not a big deal; you can make it fail very loudly when the user forgets to do so, and you can anticipate exactly when your bulky initialization happens. Do you care about performance or don't you? Don't give me this half-way hack bullshit.
But all of these are really a violation of encapsulation, having you deal with an 'instance' you should know nothing about. Static methods (or plain old functions in non-shitty languages) is the real solution here. Do your class loader hack if you want; just hide it from the users of your module.