News for hackers. Stuff that matters.
Re:Singleton Is a Bad Idea by nedbat on Sunday April 10, 2022 @03:03PM (#30980525)
If you need just one, make just one. Why should the class enforce it?
Re:Singleton Is a Bad Idea by thfuran on Sunday April 10, 2022 @04:23PM (#30981333)
Why deliberately avoid enforcing design constraints? I mean, why not just make everything a void * and cast as needed and promise not to mess up?
Re:Singleton Is a Bad Idea by nedbat on Sunday April 10, 2022 @05:53PM (#30982089)
You can enforce the constraint, but it shouldn't be in the class itself. How to you make instances for tests?