Chrome V8将实现ES6的类语法(class)


发布者 newghost  发布时间 1408348027861
关键字 技术前沿  JavaScript 
注* JavaScript中终于可以用class来声明一个类了,不过这个功能目前应该不会很快进入正式发布的浏览器中,而会像其他ES6语法那样通过harmony标签来启用。

实现的ES6类实现包括:
- class 声明语法
- 加强对象语法(object)
- 添加'super'关键字和Function.prototype.toMethod方法

这些功能将通过 --harmony-classes 标签来启用

注* 其他--harmony-标签参见: 在Node.JS使用ES6

负责人: Adam Klein (adamk@chromium.org), Erik Arvidsson (arv@chromium.org), Dmitry Lomov (dslomov@chromium.org)

# TC39 接受的功能


Class(在“最大 - 最小”中妥协产生),已经加入ES6中一年多了。最终的ES6规格书也已经完成了很久。 

在2014年7月的TC39会议中,提出了一些大量修改实例语义类的建议,因此该规范在某些方面可能仍然会有些变化。 

但是实现类(class)是V8中的最重要的一项工作,并对Javascript社区至关重要。对该TC39接受的功能的反馈越早越好,这一点是关重要。这样才能减轻规格变化的影响,两位负责人(Erik & Dmitry)直接参与了TC39“实例化改革”的建议。因此,我们认为现在是实施ES6 Class的合适时机。

# 其他供应商的利益 


目前还没有浏览器厂商支持ES6的class,尽管Firefox和IE的表明有这样做的意图。 

# 技术方面 


设计文档: https://docs.google.com/a/chromium.org/document/d/1UaIt5SeiM-DI8tSOhtM39eSOpjkDiv2UxP9eFK35Rno/

Cheers,
Adam, Erik, Dmitry




原文地址可能需要翻墙,附原文如下:

Implement ES6 classes including:

- class declaration syntax

- enchancements to objects literal syntax

- ‘super’ keyword and Function.prototype.toMethod

The implementation will proceed in V8 under --harmony-classes flag.


Owners: Adam Klein (adamk@chromium.org), Erik Arvidsson (arv@chromium.org), Dmitry Lomov (dslomov@chromium.org)


# TC39 acceptance


Classes (in the form of compromise “maximally-minimal” classes) has been a part of ES6 for more than a year now. The complete spec has been in ES6 specification draft for quite a while.


At a July 2014 TC39 meeting some significant changes to instantiation semantics for classes were proposed, so the specification may still change in certain aspects.


However implementation of classes is a significant effort for V8, and critically important for Javascript community. It is critical that TC39 receives deep implementation feedback on the feature earlier than later. To mitigate spec changes impact, two of the owners (Erik & Dmitry) are directly involved with ‘instantiation reform’ proposal on TC39. Therefore we believe now is the right time to proceed with ES6 classes’ implementation.


# Interest from other vendors


None of browser vendors currently ship ES6 classes, even though both Firefox and IE stated the intent of doing so.


# Technical considerations


Design document:

https://docs.google.com/a/chromium.org/document/d/1UaIt5SeiM-DI8tSOhtM39eSOpjkDiv2UxP9eFK35Rno/



Cheers,
Adam, Erik, Dmitry





回复 (1)
  • #
  • #1 empty_flower 1408348925005

    这些被GO抛弃的东西怎么又跑到JS上来了,就是不知道对性能没有影响。 不过Java程序员用起来应该很顺手。

微信扫码 立即评论