
Johannes Waldmann wrote:
Adrian Hey wrote:
There are plenty situations where it makes no semantic sense to allow 2 or more or some "thing". A list of all active processes for example.
"all" referring to what scope? perhaps there occurs a situation with several process (thread) pools, severals cores etc.
Seeing as we're talking about an OS kernel I guess the scope would be all processes active on the (possibly virtual) machine being managed by the OS. But it really doesn't matter what the scope is. "All" is the key word here.
See also "singleton considered harmful", there are similar arguments: http://www.oreillynet.com/cs/user/view/cs_msg/23417
Following the arguments made against the singleton pattern over the years leads me to conclude there are 2 distinct camps. Applications programmers who consider it bad because it's way of making "global variables" and we all know how bad they are, right? Typically these folk appear to have no clue about how the underlying IO library, "framework" and OS infrastructure they are dependent on *actually works*. System programmers who recognise the need for singletons but regard being forced to use the singleton pattern hack as language design defect. The situation seems similar with us. The unsafePerformIO hack is just terrible (especially for a language like Haskell), but why is it being used so often? Is it incompetance of library writers or a language design defect? Regards -- Adrian Hey