Singletons are not an “anti-pattern”. They are used incorrectly by many, so they become anti-patterns in the general case.
A proper use of singletons - and usually they are behind the scenes so you don’t even know they are a singleton - is the proper design for many architectures - especially for memory constrained devices. > On Jan 17, 2019, at 4:07 PM, Ian Denhardt <i...@zenhack.net> wrote: > > Quoting Space A. (2019-01-17 16:46:17) > >> Go's package-level variables are also not "globals". And you can >> control access with exported/unexported names or exported/unexported >> package-level functions. > > Exactly. A namespaced global is still a global, and most of the problems > with them still apply. > > This is also why "singletons" are an antipattern -- they're just dressed > up globals. > > -- > You received this message because you are subscribed to the Google Groups > "golang-nuts" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to golang-nuts+unsubscr...@googlegroups.com. > For more options, visit https://groups.google.com/d/optout. -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.