The new language Hack is a direct descendant of PHP, based on its syntax. Hack created specifically for the virtual machine HHVM (Hip Hop Virtual Machine). The Facebook team has completely translated the development into a new language and calls this migration a great success. However, Facebook does not refuse to support PHP and plans to finalize support for PHP5 in HHVM.
Detailed language documentation is available
here (in English).
The official site of the new language is
http://hacklang.org/ .
News about the release of the language.Code example
<?hh class MyClass { public function alpha(): int { return 1; } public function beta(): string { return 'hi test'; } } function f(MyClass $my_inst): string {
New language features
The main feature of Hack was the implementation of static typing. This required disabling some of the features of the language, such as the variable in the $$ variable and the extract function (implicitly creating variables in the symbol table from an array).
Also, many features from modern programming languages were introduced: generalized programming, type aliases, nullable types and restrictions on type parameters, collections, lambdas, and also checking return types and parameter types at run time.
Types are checked by a special server (service, daemon), which monitors changes in the source code files on disk.
It is not yet clear how the programmer is notified, but several tools come with Hack.Thanks, Facebook, maybe this is what PHP was missing for so long!