Facebook’s Hack, New Programming Language For HHVM, Annotates Function Signatures And Class Members With Type Information

Facebook has recently released Hack, a programming language developed for HHVM, that comfortably interoperates with PHP. Using Hack, developers now will be able to write code faster and with less errors. It has become possible because Hack has combined the elements of both the dynamic and the static languages. So the coders will now be able to work with the efficiency they get when working with the dynamic language and will be able to detect errors before runtime, similar to the early mistake detection feature available with a static language.

The official blog post of Facebook explains, “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.

Within Hack's type system, we have introduced several features such as generics, nullable types, type aliasing, and constraints on type parameters. These new language features are unobtrusive, so the code you write with Hack will still look and feel like the dynamic language to which PHP programmers are accustomed.”

Facebook has also released an open source version of Hack, as part of their HHVM runtime platform, to the public, at hack, supporting both Hack and PHP. Visit Facebook engineers official blog post for a detailed information on Hack.

Build smarter apps with Machine Learning, Bots, Cognitive Services - Start free.

Start Learning Now