Open masak opened 6 years ago
Rust has a "once cell" crate. Food for inspiration.
All of a sudden I'm also reminded of Josh Bloch's insistance that the singleton pattern should be implemented using enums. This has something to do with the built-in guarantees provided by the Java Virtual Machine itself during initialization.
From https://github.com/masak/007/issues/313#issuecomment-401594975:
I think it can be done in pure 007. Funnily enough, we'll need another hidden
COMPILING::
variable to express it: