for how much I love being ignored, I agree on Brendan, once deleted, which
is an explicit action that means "get this stuff out of my environment"
nothing else should be affected.

If people would like to create enumerable/configurable/writable properties
at runtime together with specific inheritance they can do that easily as
I've done in redefine.js [1] or as shown here

function create(inheritance, properties) {
  var k, result = Object.create(inheritance);
  for (k in result) {
    if (properties.hasOwnProperty(k)) {
      result[k] = properties[k];
    }
  }
  return result;
}

so instead of

var o = {
  __proto__: null,
  a: 'a'
};

var o = create(null, {
  a: 'a'
});


not a big deal to cover the case, impossible to get rid of __proto__
otherwise if sticks around even after deleting it from Object.prototype
(again, as explicit developer/user intention)



On Sun, Apr 21, 2013 at 12:31 PM, Brendan Eich <bren...@mozilla.com> wrote:

> Allen Wirfs-Brock wrote:
>
>> On Apr 21, 2013, at 12:05 PM, Brendan Eich wrote:
>>
>>  What I mean is that:
>>>>>      let obj = {__proto__: null}
>>>>> will always create an object whose [[Prototype]]
>>>>>
>>>> Didn't you mean "an object whose property named '__proto__'" here?
>>>
>>>  is null.  Regardless of whether or not anybody has done:
>>>>>     delete Object.prototype.__proto__.
>>>>>
>>>> Yes, that's what I just wrote!
>>>>
>>>> What part was unclear?
>>>>
>>> Sorry, I misread your "[[Prototype]] is null" as "property named
>>> '__proto__' is null".
>>>
>>> But you cannot break ES5. Why are you changing things to deviate from
>>> it, never mind from ES6 consensus?
>>>
>>>
>> We must be talking across each other...web reality is that
>>     var obj = {__proto__: someObj};
>>
>> creates a new object whose [[Prototype]] is the value of someObj
>> (assuming it is valid for that use).  Right?
>>
>
> Argh, you're right. I'm wrong, the de-facto standard wants [[Put]] not
> [[DefineOwnProperty]] and that's what ES5 specified.
>
> I plead jetlag and throw myself on the mercy of the court!
>
>
>     Doesn't that mean that ES5 implementations that support that semantics
>> already deviate from the ES5 spec which says that an own property named
>> "__proto__" should be created via [[DefineOwnProperty]]?
>>
>
> That follows.
>
> However, let's get back to (a) coffee :-); (b) ES6 and the ability to
> delete Object.prototype.__proto__.
>
> You don't want that to affect object literals evaluated in the same realm
> after such a deletion. Why not?
>
> SpiderMonkey at least goes out of its way to do [[Set]] (let's call it)
> not [[DefineOwnProperty]] for 'o = {__proto__: 42}', so why wouldn't
> [[Set]] create a fresh property, seeing nothing on Object.prototype named
> '__proto__' with a setter to run?
>
> /be
>
> ______________________________**_________________
> es-discuss mailing list
> es-discuss@mozilla.org
> https://mail.mozilla.org/**listinfo/es-discuss<https://mail.mozilla.org/listinfo/es-discuss>
>
_______________________________________________
es-discuss mailing list
es-discuss@mozilla.org
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to