2 ms·
That's a pretty terrible example. No way do you want temporary directories to be created just by loading a class. That violates all sorts of best practices. Th
by IshKebab 5y ago
That's a pretty terrible example. No way do you want temporary directories to be created just by loading a class. That violates all sorts of best practices.
There's a better example here: https://v8.dev/features/class-static-initializer-blocks https://v8.dev/features/class-static-initializer-blocks
You could also use it for initialising generated constants.
- ricardobeat 5y agoWhat’s the difference from declaring the entropy pool in the example outside the class, in the module scope? Still private, still a single shared value.
- IshKebab 5y agoI think just scope (same reason static class members exist).