Removing String, Number and Boolean
Mark S. Miller
erights at google.com
Sun May 9 15:14:41 PDT 2010
On Sun, May 9, 2010 at 3:08 PM, Mike Samuel <mikesamuel at gmail.com> wrote:
> 2010/5/9 Mark S. Miller <erights at google.com>:
> > On Sun, May 9, 2010 at 2:41 PM, Erik Arvidsson <erik.arvidsson at gmail.com
> > wrote:
> >> We have previously discussed removing the object wrappers of string,
> >> number and boolean, referred to as String, Number and Boolean. It is
> >> too bad we forgot about these when we introduced strict mode in ES5. I
> >> hope we can remove them from Harmony?
> > We didn't forget. (In fact, we spent a long time working this out.)
> > ES5/strict removes these wrappers as much as it can given the
> > Remember that strict vs non-strict is per code, not per heap. Strict and
> > non-strict code must co-exist in the same heap with access to the same
> > objects. Thus, we can't actually remove the wrappers without breaking
> > compatibility. What ES5/strict did instead is to remove from strict code
> > case that causes implicit wrapping -- the coercion of "this" to an
> > An example is at
> > <
> > As shown by this example, the net effect is that booleans still act like
> > they inherit from Boolean.prototype, but without the wrapping confusion.
> > Likewise of course for all primitive types.
> > Together, if a whole program
> > * only contains strict code
> > * never explicitly calls a wrapper constructor
> * never explicitly calls Object(...)
Yes. Good catch.
> * never attaches a non-strict method to a wrapper or Object prototype
> that returns this
The existence for a non-strict method anywhere within the whole program
violates my first condition.
> > then it should never encounter any wrappers.
> >> --
> >> erik
> >> _______________________________________________
> >> es-discuss mailing list
> >> es-discuss at mozilla.org
> >> https://mail.mozilla.org/listinfo/es-discuss
> > --
> > Cheers,
> > --MarkM
> > _______________________________________________
> > es-discuss mailing list
> > es-discuss at mozilla.org
> > https://mail.mozilla.org/listinfo/es-discuss
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the es-discuss