3 Matching Annotations
- Aug 2022
-
gbracha.blogspot.com gbracha.blogspot.comRoom 1011
-
Static variables are bad for re-entrancy. Code that accesses such state is not re-entrant. It is all too easy to produce such code. Case in point: javac. Originally conceived as a batch compiler, javac had to undergo extensive reconstructive surgery to make it suitable for use in IDEs. A major problem was that one could not create multiple instances of the compiler to be used by different parts of an IDE, because javac had significant static state.
Walter Bright described similar issues with the Digital Mars compiler in a recent NWCPP talk "Adding Modules to C in 10 Lines of Code", albeit Walter's compiler sounds like it was far easier to fix.
It's funny that this happens with compilers. Wirth's Oberon compiler (module ORP) also depends on static state. But compilers seem natural to me to be something that you want to allow multiple instances of—it's not even among the list of things I'd expect people to make excuses for (cf https://kentonshouse.com/singletons).
Tags
Annotators
URL
-
- Jun 2022
-
-
as long as the compiler doesn't use a bunch of global variables to store the compiler state, you can use it to run another instance of itself
In other words, singletons are harmful.
Tags
Annotators
URL
-
- May 2022
-
www.object-oriented-security.org www.object-oriented-security.org
-
When creating a singleton, the author is making the assumption that no program will ever have any reason to have more than one instance of the class. This is a big assumption, and it often proves wrong later on when the requirements change.
-