On 1/5/12 2:12 PM, Travis Leithead wrote: > I thought Cameron proposed another alternative, which I much prefer over adding another object to the prototype chain: > >> From: Cameron McCormack [mailto:cam@mcc.id.au] >> If we want var statements without a variable assignment to shadow named >> properties, then we can't keep [[GetOwnProperty]] returning property >> descriptors for them while [[HasProperty]] returns true for them, >> without violating the ECMAScript spec. >> >> We could either make [[HasProperty]] return false for named properties >> on window despite [[GetOwnProperty]] returning a property descriptor. >> Or, we could make the window object have a custom [[GetProperty]] >> instead of [[GetOwnProperty]], so that [[HasProperty]] returns false and >> [[GetOwnProperty]] returns undefined, while fetching the property off >> the object still gives you the named property value. It's not entirely clear to me whether this works for the window in particular, because as far as I can tell the bareword lookup algorithm in ES relies on [[HasProperty]] before ever calling [[Get]]. I could well be wrong on that, though; I don't follow that section of the spec very well. -BorisReceived on Thursday, 5 January 2012 19:23:22 UTC
This archive was generated by hypermail 2.3.1 : Tuesday, 6 January 2015 21:37:46 UTC