javascript中的java关键字
根据这个页面 http://www.quackit.com/javascript/javascript_reserved_words.cfm javascript有一些来自java的关键字,保留。我还注意到编辑器中的突出显示。这是为了未来的证明吗?他们是否计划在 JavaScript 中实现更多 OOP 风格的运算符?
我很想在 js 中看到接口、抽象类和类似的东西,但是这些词的保留是否表明了什么?
according to this page
http://www.quackit.com/javascript/javascript_reserved_words.cfm
javascript has some keywords which are from java, reserved. I also notice that with the highlighting in my editor. Is this to be future proof? Are they planning to implement some more OOP style operators into javascript?
I would love to se interfaces, abstract classes and things like that coming to js, but does the reservation of these words indicate anything?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
来自 ECMA-262 规范,§7.6.1.2 (未来保留字):
并且,来自 §2 (一致性):
From the ECMA-262 spec, §7.6.1.2 (Future Reserved Words):
And, from §2 (Conformance):
保留这些词只是为了向原作者 (Brendan Eich) 提供构建关键字的起点。
目前没有计划将特定的 Java 功能集成到 Javascript 中。 当前路线图建议了以下功能:
The words are reserved only to offer the original author (Brendan Eich) a starting point on which to build keywords.
There are currently no plans to integrate specific Java features into Javascript. The current roadmap suggests these features:
不,他们不保证任何事情,他们最初是为了“以防万一”而保留的,从那时起就一直保留在该语言中。它们可能会也可能不会被使用,但大多数在不久的将来不会被使用。
No they don't guarantee anything, they were originally reserved "just in case" and have stuck in the language since then. They may or may not get used but most will not be used in the near future.
@Andy 和 @OriginalSyn 已经回答了你的问题,我只想回答这个问题:
这些结构不太可能出现在 JavaScript 中。 JS 遵循基于原型 OOP 模型,不使用类之类的东西。与经典的基于类的模型相比,该模型具有一些优势,您必须喜欢它,否则就停止使用 JS,因为这种语言没有真正的替代品。 ;)
@Andy and @OriginalSyn already answered your question and I just wanted to answer to this:
It's very unlikely that these constructions have ever appear in JavaScript. JS follows prototype-based OOP model which doesn't use things like classes. This model has some advantages over classical, class-based model and you'll have to love it or stop using JS as there is no real alternative for this language. ;)