Ahh, thanks. Somehow I read that as `Object(undefined)` -> ObjectCreate(undefined)` -> throw, but that's not the case.
On Mon, Jul 15, 2013 at 11:39 AM, Mark S. Miller <[email protected]> wrote: > Object(undefined) would still not throw: > http://people.mozilla.org/~jorendorff/es6-draft.html#sec-15.2.1.1 step 1 > > > On Mon, Jul 15, 2013 at 8:37 AM, Jeremy Martin <[email protected]> wrote: > >> > That's unpleasant. [...] Much old code will break. >> >> Indeed. I hadn't actually noticed that change until just now. It looks >> like ES6 code can take advantage of Object.isObject(), which seems to >> delegate the work to Type(*x*) [1]. It wasn't overwhelmingly clear to >> me, but I would assume `Object.isObject('foo') === false` and >> `Object.isObject(new String('foo')) === true`. >> >> Has anyone surveyed/looked into what the fallout of throwing on stuff >> like `Object(undefined)` will be? >> >> [1] http://people.mozilla.org/~jorendorff/es6-draft.html#sec-8 >> >> On Mon, Jul 15, 2013 at 11:09 AM, Mark S. Miller <[email protected]>wrote: >> >>> I see. That's unpleasant. In ES5, Object(x) can never throw, and so the >>> code paths using |x === Object(x)| are not prepared for a throw. Much old >>> code will break. >>> >>> >>> On Mon, Jul 15, 2013 at 8:01 AM, Jeremy Martin <[email protected]>wrote: >>> >>>> > s === Object(s) >>>> >>>> This should throw a TypeError. In the case of a Symbol, `Object(*value >>>> *)` results in `ToObject(*value*)` [1]. And, in the case of Symbol, >>>> ToObject should throw a TypeError [2]. >>>> >>>> [1] http://people.mozilla.org/~jorendorff/es6-draft.html#sec-15.2.1.1 >>>> [2] http://people.mozilla.org/~jorendorff/es6-draft.html#sec-9.1.9 >>>> >>>> On Mon, Jul 15, 2013 at 10:48 AM, Mark S. Miller <[email protected]>wrote: >>>> >>>>> Given that s is a Symbol and b is a Bignum, is >>>>> >>>>> s === Object(s) >>>>> >>>>> ? >>>>> >>>>> Is >>>>> >>>>> b === Object(b) >>>>> >>>>> ? >>>>> >>>>> The reason I ask is that x === Object(x) is often used to distinguish >>>>> primitive values from objects. The other thing that's often used is >>>>> typeof, >>>>> but these uses of typeof usually assume that the full range of possible >>>>> answers is already known. If we're going to be expanding the typeof >>>>> answers, then we need guidance on how to write this test now (es5) such >>>>> that it stays robust. >>>>> >>>>> >>>>> -- >>>>> Cheers, >>>>> --MarkM >>>>> >>>>> _______________________________________________ >>>>> es-discuss mailing list >>>>> [email protected] >>>>> https://mail.mozilla.org/listinfo/es-discuss >>>>> >>>>> >>>> >>>> >>>> -- >>>> Jeremy Martin >>>> 661.312.3853 >>>> http://devsmash.com >>>> @jmar777 >>>> >>> >>> >>> >>> -- >>> Cheers, >>> --MarkM >>> >> >> >> >> -- >> Jeremy Martin >> 661.312.3853 >> http://devsmash.com >> @jmar777 >> > > > > -- > Cheers, > --MarkM > -- Jeremy Martin 661.312.3853 http://devsmash.com @jmar777
_______________________________________________ es-discuss mailing list [email protected] https://mail.mozilla.org/listinfo/es-discuss

