Skip to Main Content
Hack 与HHVM 权威指南
book

Hack 与HHVM 权威指南

by Owen Yamauchi
March 2017
Beginner content levelBeginner
247 pages
3h 55m
Chinese
China Machine Press
Content preview from Hack 与HHVM 权威指南
134
6
async function
admins_from_list(Traversable<int> $ids): Awaitable<Vector<int>> {
return
HH\Asio\vf($ids, fun('is_user_admin'));
}
值得注意的是,
HH\Asio\v()
HH\Asio\m()
并不是
asio-utilities
一部分,它们
内置在
HHVM
中,所以在
Hack
代码中总是有效的。
6-1
展示了这个助手函数的全部范围,以及它们的功用。
6-1asio-utilities 助手函数
名称
返回类型
回调
传递键到回调?
包装异常?
v() Vector
N/A
vm() Vector
Mapping No No
vmk() Vector
Mapping Yes No
vf() Vector
Filtering No No
vfk() Vector
Filtering Yes No
vw() Vector
Filtering Yes No
vmw() Vector
N/A N/A Yes
vmkw() Vector
Mapping Yes No
vfw() Vector
Mapping No Yes
vfkw() Vector
Filtering Yes Yes
拉姆达表达式语法(见
3.4
节)和这些异步助手函数联合使用起来是非常方便的。拉姆
达表达式可以减少闭包语法所需要的模板代码。下面改写一个以前的范例。 ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Reinventing the Organization for GenAI and LLMs

Reinventing the Organization for GenAI and LLMs

Ethan Mollick

Publisher Resources

ISBN: 9787111554844