Functions
函数作为一等值、多返回值与命名结果、变参打包、闭包捕获与 Go 1.22 的每轮循环变量、defer 的求值顺序与 panic 展开、值接收者复制与指针接收者共享、方法集与接口满足、结构体嵌入与方法提升、方法值绑定接收者的时机、init 的初始化顺序与常见风险、调用求值顺序与 nil 函数调用。
函数作为一等值、多返回值与命名结果、变参打包、闭包捕获与 Go 1.22 的每轮循环变量、defer 的求值顺序与 panic 展开、值接收者复制与指针接收者共享、方法集与接口满足、结构体嵌入与方法提升、方法值绑定接收者的时机、init 的初始化顺序与常见风险、调用求值顺序与 nil 函数调用。
Java 把行为写成方法、lambda、方法引用与函数接口,本页拆解重载解析、变长参数、捕获规则与 invokedynamic 在运行时的真实代价。
Functions as first-class values: declaration forms, parameters, lexical scope, hoisting and the temporal dead zone, closures, and the four rules that fix this at call time.
Argument binding, closures and decorators, generators, context managers, the exception contract, and the gradual type system that documents all of them.
Rust 把函数与闭包当作可传递的值:fn 项、泛型约束、捕获方式与 Fn 系列 trait 共同决定调用点是内联、单态化还是间接调用。