Remix.run Logo
m-schuetz 5 hours ago

I liked using singletons back in the day, but now I simply make a struct with static members which serves the same purpose with less verbose code. Initialization order doesn't matter if you add one explicit (and also static) init function, or a lazy initialization check.

procaryote an hour ago | parent [-]

Yeah, I feel singletons are mostly a result of people learning globals are bad and wanting to pretend their global isn't a global.

A bit like how java people insisted on making naive getFoo() and setFoo() to pretend that was different from making foo public