• Right, that won't work—Object.freeze only sets the meta object descriptor properties to: [[configurable]]: false, [[writable]]: false. It won't turn a non-object into a const. What you could do is provide a "built-in" keyword whose value is true and is essentially a const binding. Special keywords are safe additions, as long as they're not any of the FutureReservedWords: class, enum, extends, super, const, export, import, implements, let, private, public, interface, package, protected, static or yield; additionally, there is precedent in node with bindings like process, which aren't const, but are special (if you attempt to reassign it, the process itself will crash)

About

Avatar for rwaldron @rwaldron started