In ES5, Boolean.prototype
is a Boolean object:
The Boolean prototype object is itself a Boolean object (its [[Class]] is "Boolean") whose value is false.
In ES6 / ES2015, it isn't:
The Boolean prototype object is an ordinary object. It is not a Boolean instance and does not have a [[BooleanData]] internal slot.
In ES2016, it is once again:
The Boolean prototype is itself a Boolean object; it has a [[BooleanData]] internal slot with the value false.
(and it remains so in ES2017 as well.)
The same is true for Number.prototype
and String.prototype
—while on the other hand Date.prototype
and RegExp.prototype
also began as instances of their respective [[Class]]es in ES5.1, became plain Objects
in ES6 and have remained that way since.
The reversion, in ES2016, does not appear to have been the subject of any tc39 proposal.
Why were these changes made in ES6, and then (only) partially reverted in ES2016?
(This question is not just for academic/historical interest: I am working on a JavaScript dialect that is intended not to include the boxed primitive types but which still requires the .prototype
objects to hold all the methods that can be invoked on primitive values, and while it's feasible to special-case the .prototype
objects as being the only instances of their respective [[Class]]es, I'd like to understand why that might be desirable.)