Facebook Reveals Hack: A New Programming Language for HHVM
Today, Facebook has released Hack, a new programming language that was developed for HHVM that integrates seamlessly with PHP.
Hack takes advantage of the fast development cycle of PHP, but it provides static typing and adds many features of modern programming languages.
Hack has deep roots in PHP. In fact, most PHP files are already valid Hack files. We made a conscious choice not to support a handful of deprecated functions and features that were incompatible with static typing (e.g. “variable variables” and the extract() function). We have also added many new features that we believe will help make developers more productive.
Our principal addition is static typing. We have developed a system to annotate function signatures and class members with type information; our type checking algorithm (the “type checker”) infers the rest. Type checking is incremental, such that even within a single file some code can be converted to Hack while the rest remains dynamically typed. Technically speaking, Hack is a “gradually typed*”* language: dynamically typed code interoperates seamlessly with statically typed code.
An open source version of Hack is available to the public from http://www.hacklang.org/ and is part of the HHVM platform, which will now support both Hack and PHP.
[via Facebook Code]