Skip to content

70 函数声明引用 ​

double.function 以受类型检查的函数签名指向声明。得到的值既能提供元数据,也能直接调用。

norm
Integer double(Integer value) { return value * 2 }

main() {
  Function<Integer(Integer)> action = double.function
  printLine(action.name())
  printLine(action(7))
}

预期输出:

text
double
14

动手试试:重命名 double,让编译器同步更新引用。

精确规则:参考。

Norm 0.25