问题标签 [hacklang]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
2 回答
1431 浏览

php - Codeigniter 和 Hack 语言

我想知道如何以及是否可以在 codeigniter 模型和控制器中使用 HHVM 运行 Hack 代码。

还有任何积极的努力将像 CI 这样的 PHP 框架移植到 Hack 中吗?

0 投票
1 回答
74 浏览

hhvm - 什么是 Hack 语言中的“可变形”?

这个 Facebook 示例展示了 Hack 转换器如何从和函数中删除Transformable类型提示。为什么?是一些内置的 Hack 接口或类吗?transform()wonderland()Transformable

0 投票
2 回答
3575 浏览

asynchronous - Hacklang 异步代码示例?

如何修改以下代码以异步获取文章数据和热门文章?

0 投票
0 回答
652 浏览

python - 立即启动 Python asyncio courutines 执行

我正在尝试了解 Python asyncio模块。它似乎比其他语言中的类似功能要复杂得多。

这是文档的摘录

Calling a coroutine does not start its code running – it is just a generator, and the coroutine object returned by the call is really a generator object, which doesn’t do anything until you iterate over it. In the case of a coroutine object, there are two basic ways to start it running: call yield from coroutine from another coroutine (assuming the other coroutine is already running!), or schedule its execution using the async() function or the BaseEventLoop.create_task() method.

Coroutines (and tasks) can only run when the event loop is running.

Does it mean that it is impossible to achieve similar execution flow like here with Hack?

As you can see, genInfo() execution starts immediately after call and yields on the await statement. I think that such execution flow is much more natural then this one with Python.

Is there any way to achieve the same in Python?

I tried to iterate coroutines generators one time (in order to allow them to execute and approach first yield) before passing them to loop.run_until_complete(), but without success.

0 投票
2 回答
553 浏览

lambda - 在 HHVM/Hack lambda 表达式中更改词法范围变量的值?

是否可以在 Hack lambda 表达式中更改词法范围变量的值?

我希望返回值是false

0 投票
1 回答
249 浏览

hhvm - 在一个文件上运行 hh_client 会永远挂起

我使用了此链接 centos install docs中的构建说明

它似乎安装得很好。我跑了 hhvm --version

HipHop VM 3.5.0-dev+2014.12.11 (rel) Compiler: heads/master-0-g546087bf1b0560c4a9e254fcad46a9212e42ccc2 Repo schema: cf1780b3cc3857e091e924935ae6267e9794de9c Extension API: 20140829

因此,按照引导文档,我创建了一个包含 2 个文件(test.php 和 .hhconfig)的目录

我将以下代码添加到 test.php

在这个目录中我运行 hh_client 并且以下消息出现了很长时间 20-30 分钟+。这是正常的吗?我尝试使用已经安装并安装了 hhvm 的 docker 容器并获得了相同的行为。

0 投票
1 回答
1034 浏览

arrays - 将元素添加到可为空的向量

好的,所以我得到了一个私有的 ?Vector $lines,它在构造对象时是空的,现在我想向该向量添加字符串。以下Hack代码运行良好:

但是当使用 hh_client 检查代码时,它给了我以下警告:

问题:如何在检查器不推送此警告的情况下向 Vector 添加元素?

0 投票
3 回答
805 浏览

code-coverage - hack 语言的代码覆盖工具

是否有用于 Hack 语言的代码覆盖工具(在 hhvm 上)?

这个问题不是关于在 hhvm 上运行的 PHP 源代码的代码覆盖率(例如可以使用 PHPUnit),而是生成用 hack 语言编写的源代码的代码覆盖率。

0 投票
1 回答
552 浏览

typechecking - 从 .hhconfig 禁用类型检查

假设我们有一个具有以下结构的项目:

根/

.hhconfig

├── 目录1

├── 目录2

├── 目录3

…………………………………………………………………………………………………………

├── 目录10

有没有办法拥有一个.hhconfig文件,并且directory8从类型检查中排除?我认为将单独的.hhconfig文件放在每个目录中或声明为UNSAFE所有文件directory8以便从类型检查中排除是非常痛苦的。

0 投票
1 回答
102 浏览

hhvm - 类型检查器的 HHVM 非确定性行为

我注意到调用 hh_client 并不总是返回正确的结果。例如:我有以下代码:

后端\ConvertMessage.hh:

项目中的其他地方:

有时,在对项目进行一些更改后,我会收到以下错误消息:Could not find static method getNames in type ApiBackend\ConvertMessage\Status (Typing[4090])

当我在一个右大括号后删除分号时,hh_client 停止显示错误。但是当我在它的位置插入分号时,类型检查器仍然给我No errors!消息。

这不是导致此问题的唯一文件 - 它发生在所有枚举中。

在我看来,hh_client 或 hh_server 的某些缓存有问题。

提前感谢您帮助我解决了这个问题(如果我的英语不太好,我很抱歉)。