Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这里如果加入参的话需要增加一个闭包
原文里意图是把 wrapper 当作 func 一样使用,所以 apply 这里有个 arguments 的透传。即 fn(xxx) 等同于 wrapper(xxxx),这么改 arguments 读了 func 又作为参数传给了自己就不对了
传 func 的话就应该是
之后通过 fn(x) 得到 x 的 wrapper
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这个例子主要还是想用 wrapper 的 apply 来说明执行和 func 一样,所以 wrapper 的 arguments 直接透传给了 fn
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
确实是这样,我理解错了,这里本意是一个用于返回的包装器