V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
V2EX 提问指南
rabbbit
V2EX  ›  问与答

[ECMAScript] Let func be the function whose [[Call]] internal method initiated execution of code 是啥意思?

  •  
  •   rabbbit · 2018-11-13 09:20:03 +08:00 · 886 次点击
    这是一个创建于 1989 天前的主题,其中的信息可能已经有所发展或是发生改变。

    http://ecma-international.org/ecma-262/5.1/#sec-10.5
    第 10.5 节
    Let func be the function whose [[Call]] internal method initiated execution of code

    这句是啥意思?
    是令 func 为调用 F 内部方法[[call]](func = F.[[call]])的结果吗?

    另外,求推荐个靠谱的前端交流群

    第 1 条附言  ·  2018-12-02 17:21:54 +08:00
    这个 func 就是被调用的函数对象本身
    见步骤 7,调用抽象操作 CreateArgumentsObject 创建 arguments
    ```
    Let argsObj be the result of calling the abstract operation CreateArgumentsObject (10.6) passing func, names, args, env and strict as arguments.
    ```
    再往下看 10.6 中关于 CreateArgumentsObject 的描述之步骤 13
    如果是非严格模式,调用内部方法 DefineOwnProperty("callee")
    ```
    If strict is false, then
    Call the [[DefineOwnProperty]] internal method on obj passing "callee", the property descriptor {[[Value]]: func, [[Writable]]: true, [[Enumerable]]: false, [[Configurable]]: true}, and false as arguments.
    ```

    已经很明显了,argument.callee 指向的是当前所在函数
    4 条回复    2018-11-13 11:17:17 +08:00
    robinlovemaggie
        1
    robinlovemaggie  
       2018-11-13 09:56:35 +08:00   ❤️ 1
    func 定性为关键字,用来函数初始化。
    mcfog
        2
    mcfog  
       2018-11-13 10:13:09 +08:00 via Android   ❤️ 1
    你的理解里的这个大 F 是哪里冒出来的?
    令 func 为一个 function,其[[call]]内部方法启动(相应)代码的执行过程

    这更多是一个中学英语的问题
    mcfog
        3
    mcfog  
       2018-11-13 10:17:15 +08:00 via Android
    用伪代码写的话是
    declaration-binding.func = new function({ [[call]]() { execute code } })
    rabbbit
        4
    rabbbit  
    OP
       2018-11-13 11:17:17 +08:00
    @mcfog
    翻译成中文也没看懂这步在干啥...
    不过谢啦
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   1257 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 25ms · UTC 18:05 · PVG 02:05 · LAX 11:05 · JFK 14:05
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.