We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
看到了这个。 其实闭包可以用结构体来模拟,很多语言也是怎么做的,比如如下闭包:
let a = () => 1 + 2; print(a());
展开为:
class A { function call() { return 1 + 2; } } let a = new A; print(a.call());
那么如果要捕获作用域里的变量呢?
let cat = 114513; let a = () => 1 + cat; print(a());
class A { var _cat; A(cat) { this._cat = cat } function call() { return 1 + this._cat; } } let cat = 114513; let a = new A(cat); print(a.call());
相信已经懂了吧,要传入参数也是一样。
The text was updated successfully, but these errors were encountered:
tql橘子
Sorry, something went wrong.
No branches or pull requests
看到了这个。
其实闭包可以用结构体来模拟,很多语言也是怎么做的,比如如下闭包:
展开为:
那么如果要捕获作用域里的变量呢?
展开为:
相信已经懂了吧,要传入参数也是一样。
The text was updated successfully, but these errors were encountered: