home bbs files messages ]

Forums before death by AOL, social media and spammers... "We can't have nice things"

   comp.lang.c++.moderated      Moderated discussion of C++ superhackery      33,346 messages   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]

   Message 32,719 of 33,346   
   Peter Schneider to goran.pusic@googlemail.com   
   Re: Singletons   
   11 Dec 12 21:58:40   
   
   From: schneiderp_REMOVETHIS@gmx.net   
      
   Hi,   
      
   On 11.12.2012 05:31, goran.pusic@googlemail.com wrote:   
      
   > It looks like you and I have a different definition of a "global state".   
   > This discussion is about singletons, and (no surprise there) it had led to   
   > global variables. And those make me shudder, and you, too, I think ;-).   
      
   Well, a bit ;-).   
      
   > How about this: yes, there is global state, however, a given point in code   
   > is using only a part of it. My argument is: we should pass that part into   
   > said code; when we have "global" variables, code invariantly gets lazy and   
   > uses part of the state from parameters, and a part from globals. That   
   > results in messier than necessary situations.   
      
   I agree. And the discussion in this thread about ways around that was   
   actually very interesting (dependency injection etc.).   
      
   Peter   
      
      
   --   
         [ See http://www.gotw.ca/resources/clcm.htm for info about ]   
         [ comp.lang.c++.moderated.    First time posters: Do this! ]   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]


(c) 1994,  bbs@darkrealms.ca