Can a pure function return a Symbol? <p>This may border on philosophical, but I thought it would be the right place to ask.</p> <p>Suppose I have a function that creates a list of IDs. These identifiers are only used internally to the application, so it is acceptable to use ES2015 <code>Symbol()</code> here.</p> <p>My problem is that, <em>technically</em>, when you ask for a Symbol, I'd imagine the JS runtime creates a unique identifier (random number? memory address? unsure) which, to prevent collisions, would require accessing global state. The reason I'm unsure is because of that word, "technically". I'm not sure (again, from a philosophical standpoint) if this ought to be enough to break the mathematical abstraction that the API presents.</p> <p><strong>tl;dr:</strong> here's an example--</p> <pre><code>function sentinelToSymbol(x) { if (x === -1) return Symbol(); return x; } </code></pre> <p><em>Is this function pure?</em></p>