> Per spec, the three expressions should produce "0", as the three objects have a [[NumberData]] internal slot (step 4 of [1]). I guess there is some discrepancy between implementation and spec for those exotic edge cases?
There’s no discrepancy — they shouldn’t all produce "0", because the algorithm calls ToNumber on the value if it has the [[NumberData]] slot. This in turn calls ToPrimitive because the value is an object. This ultimately ends up calling the `@@toPrimitive` or `toValue` method _of_ the object. In the case of the object with String.prototype for its prototype, this will be `String.prototype.toValue`, which throws if its receiver doesn’t have [[StringData]]. In the case of the object with Object.prototype for its prototype, this will be `Object.prototype.toValue`. On Sat, Aug 4, 2018 at 10:31 PM Darien Valentine <[email protected]> wrote: > Oh, thanks Claude, I missed that. I guess it is all replicable then. > > On Sat, Aug 4, 2018 at 10:28 PM Claude Pache <[email protected]> > wrote: > >> >> >> > Le 5 août 2018 à 04:14, Darien Valentine <[email protected]> a >> écrit : >> > >> > >> > However it is ultimately not possible to replicate because there is no >> possible brand test for [[BooleanData]]. >> >> Per spec, checking whether `Boolean.prototype.valueOf.call(obj)` throws >> will test whether an object has [[BooleanData]] internal slot. >> >> —Claude >> >>
_______________________________________________ es-discuss mailing list [email protected] https://mail.mozilla.org/listinfo/es-discuss

