Observability of NaN distinctions — is this a concern?

Jeff Walden jwalden+es at MIT.EDU
Tue Mar 26 17:41:53 PDT 2013


On 03/26/2013 08:48 AM, Sam Tobin-Hochstadt wrote:
> While I agree with you on the larger point (and this issue reoccurs
> with proxies), the actual problem here is that [[DefineProperty]]
> should just do nothing on immutable data.  The idea of mutating
> immutable data as long as its the same value is crazy.

ValidateAndApplyPropertyDescriptor in ES6 (and its predecessor in ES5) don't mutate if every field in the input descriptor matches the existing fields in the existing descriptor.  So a non-writable, non-configurable existing property will either throw because !SameValue on the [[Value]] components, or it'll hit SameValue(nanValue1, nanValue2) and not change anything, per spec.  Crazy implementations that try to optimize here might behave differently, of course, but there's no spec issue along these lines.

Jeff


More information about the es-discuss mailing list