Skip to main content
 首页 » 操作系统

swift之未知的 Swift 语法

2024年01月01日40JustinYoung

我正在浏览 this来自 Mikeash 的博客并找到以下声明:

private let f: AnyObject -> Parameters -> Void 

我不清楚这个语法是什么意思。我尝试查看 Swift 编程指南,但没有找到任何答案。

有人可以解释一下吗,可能是一些引用?

请您参考如下方法:

参见 Swift Programming Language Reference ,章节类型,标题函数类型:

The function types of a curried function are grouped from right to left. For instance, the function type Int -> Int -> Int is understood as Int -> (Int -> Int) — that is, a function that takes an Int and returns another function that takes and return an Int. Curried function are described in Curried Functions.

(我格式化了代码部分)

参见 here有关柯里化(Currying)函数的解释。