Ecmascript 6是否支持可变的__proto__属性? [英] Does Ecmascript 6 support a mutable __proto__ property?

查看:556
本文介绍了Ecmascript 6是否支持可变的__proto__属性?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在当前的Ecmascript 6草案(2012年11月)中,对 __ proto __ 属性(B.3.1节)的官方支持。这是一个惊喜,在目前的浏览器实现中, __ proto __ 属性已被弃用。

In the current Ecmascript 6 draft (November 2012), there is official support for the __proto__ property (Section B.3.1). This came as a bit of a surprise as, in current browser implementations, the __proto__ property is deprecated.

如果目前的选秀权,ES6能否全面支持可变原型?我可以为Firefox中现有的对象提供一个新的原型吗?

If the current draft stands, will ES6 have full support for mutable prototypes? Will I be able to provide a new prototype for an existing object the way I currently can in Firefox?

推荐答案

目前,计划可变的 __ proto __ 属于规范(而不仅仅是附件b)。目前的计划是使它成为一种仅在Object.prototype上存在并充当访问者(魔法部分)的神奇数据属性。这个属性也是可以删除的,当删除时,删除这个域的变量 __ proto __ 的能力。我已经在我的ES6虚拟机中执行了 __ proto __ 的描述。 http ://benvie.github.com/continuum

Currently, it is planned for mutable __proto__ to be in the spec (and not just in annex b). The current plan is for it to be a magical data property existing solely on Object.prototype and acting as an accessor (the magical part). This property will be deletable as well, removing the ability to mutate __proto__ for that realm when deleted. I've implemented __proto__ following this description in my ES6 virtual machine http://benvie.github.com/continuum.

最初是被弃用和替换,但是在该替换中没有形成共识。从内建继承的能力是最终目标,决定是<= c $ c> __ proto __ 已经普遍(除了它之外的所有东西),并实现了这个目标,所以最小阻力的路径是要拥抱和编纂它。

Originally it was to be deprecated and replaced, but no consensus formed on that replacement was. The ability to inherit from builtins is the end goal and the decision was that __proto__ is already widespread (everything but ie has it) and fulfills this goal, so the path of least resistance was to embrace and codify it.

这篇关于Ecmascript 6是否支持可变的__proto__属性?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆