4 ms·
Could you reword the question? I don't understand what you're asking.
by carussell 11y ago
Could you reword the question? I don't understand what you're asking.
- agd 11y agoI guess I don't understand why the global symbol registry exists. If someone wants a global symbol map, they can create their own. What else does this add over a user implementation, and what are the use cases?
- pavlov 11y agoMaking the registry global allows compilers to optimize away those Symbol.for() calls, since they know that each call to Symbol.for("cat") is going to resolve to the same symbol instance.
- agd 11y agoBut if people are concerned about performance, they can just pre-allocate/memoize the symbols. It doesn't seem like the registry adds any new functionality, and it might encourage use of globals. Surely that's a bad thing?