简体   繁体   English

是否有 ECMAScript 语言规范的官方实现?

[英]Is there an official implementation of ECMAScript Language Specification?

I'm interesting in how JS source code works and seems that I should to use ECMAScript® Language Specification .我对 JS 源代码的工作方式很感兴趣,似乎我应该使用ECMAScript® Language Specification In my case I tried to write my own implemetetion of Function.prototype.call就我而言,我尝试编写自己的Function.prototype.call实现

Function.prototype._call = function (thisArg = {}, ...arg) {
  // 1. Let func be the this value.
  let func = this
  // 2. If IsCallable(func) is false, throw a TypeError exception.
  if (typeof func !== 'function') {
    throw new TypeError(this + "isn't callable")
  }
  // 3. Perform PrepareForTailCall().
  thisArg.func = func
  // 4. Return ? Call(func, thisArg, args).
  return thisArg.func(...arg)
}

It works, but I'm not sure that my implementation is correct and would like to compare it with the "official" implementation.它有效,但我不确定我的实现是否正确,并想将它与“官方”实现进行比较。 Where may I find code references for ECMAScript examples?我在哪里可以找到 ECMAScript 示例的代码参考? Thank you!谢谢!

Is there an official implementation of ECMAScript Language Specification?是否有 ECMAScript 语言规范的官方实现?

Such an implementation is known as a reference implementation , rather than an "official" implementation, as surely every conforming and certified (is that even a thing for ECMAScript?) implementation is "official".这样的实现被称为参考实现,而不是“官方”实现,因为每个符合和认证的(甚至是 ECMAScript 的东西?)的实现都是“官方的”。

But yes , there is - but as far as I can tell, only ECMAScript 4 from 2007 has (had?) an actual reference implementation which was available to download from the ECMAScript.org website .但是的,有——但据我所知, 只有 2007 年的 ECMAScript 4 有(有?)一个实际的参考实现可以从 ECMAScript.org 网站下载


https://lambda-the-ultimate.org/node/2289 https://lambda-the-ultimate.org/node/2289

ECMAScript Edition 4 Reference Implementation ECMAScript 第 4 版参考实现

The first pre-release of the reference implementation of ECMAScript Edition 4 (aka JavaScript 2) is now available. ECMAScript Edition 4(又名 JavaScript 2)参考实现的第一个预发布版本现已发布。 We've created a new web site for information about the ECMAScript specification and reference implementation.我们创建了一个新网站,用于获取有关 ECMAScript 规范和参考实现的信息。 You can download source and binary forms of the reference implementation . 您可以下载参考实现的源代码和二进制形式


No, there is no reference implementation for ECMAScript, the definitive authoriative source is the specification itself - see also its Conformance section .不,ECMAScript 没有参考实现,权威的权威来源是规范本身 - 另见其一致性部分 It is accompanied by the official Test262: ECMAScript Test Suite附带官方Test262:ECMAScript Test Suite

The closest to what you are looking for would be the Engine 262 project.与您正在寻找的最接近的是Engine 262项目。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM