Вопрос

Recently, Facebook released a new language called Hacklang, which is compiled to machine code by HHVM.

So I just wonder, is Hacklang a merely stateful language?

Thanks.

Это было полезно?

Решение

PHP is stateless unless you use some mechanism to store state (think memcache, sessions, database, etc), but you can't use global variables or some language-specific features to do so. Hacklang is a layer on top of PHP which adds static typing as well as a bunch of other things, but it's still stateless.

Since this is now an answer and I have more space, the lack of state is actually one of the things that PHP got right, every request starts on a clean slate which avoids a lot of bugs that appear between requests, each one of them is isolated from the rest. So Hack did well to keep that the same way. There's an extra cost associated to starting each request, but what you lose there you win back with HHVM's performance increase.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top