* Daniel McBrearty <[EMAIL PROTECTED]> [2006-11-16 01:35]: > a wonderful rant. except : he doesn't answer one basic question > - what do you do when you genuinely do want only one instance > to ever exist?
A singleton is nothing but a global variable, except the identifier comes from the class namespace rather than the variable namespace. Put it in a global variable already. > "print spooler" is a crap example. A much better one is an > audio player - you can only listen to one audio track at > a time, you really don't want a second one to EVER happen. This > is a reasonabvle design decision to make early for some > systems. If you want to change the behaviour one day, that's > irrelevant. I still wouldn’t want to place the knowledge that there can only be one audio stream in the audio stream class itself. That is knowledge that belongs in the app, at least one level higher than the audio stream class. Regards, -- Aristotle Pagaltzis // <http://plasmasturm.org/> _______________________________________________ List: [email protected] Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/[email protected]/ Dev site: http://dev.catalyst.perl.org/
