Introduced by Facebook[1] on March 20, 2014, Hack is a programming language that underwent extensive implementation and testing on a significant portion of the Facebook website before its official disclosure. Hack is engineered to integrate flawlessly with PHP, advancing the type hinting from PHP5 by integrating static typing. It employs a gradual typing system where type annotations are optional by default. However, Hack’s strict mode requires type annotations for sound code. Certain less prevalent PHP features are not compatible with Hack. The organization of Hack scripts bears resemblance to PHP, albeit with some fundamental distinctions. For instance, Hack files forego the `
Hack is a programming language for the HipHop Virtual Machine (HHVM), created by Meta (formerly Facebook) as a dialect of PHP. The language implementation is open-source, licensed under the MIT License.
![]() | |
Designed by | Julien Verlaguet, Alok Menghrajani, Drew Paroski, and others |
---|---|
Developer | Meta Platforms |
First appeared | 2014 |
Stable release | |
Typing discipline | Static, dynamic, weak, gradual |
OS | Cross-platform |
License | MIT License |
Website | hacklang |
Influenced by | |
PHP, OCaml, Java, C#, Scala, Haskell |
Hack allows programmers to use both dynamic typing and static typing. This kind of a type system is called gradual typing, which is also implemented in other programming languages such as ActionScript. Hack's type system allows types to be specified for function arguments, function return values, and class properties; however, types of local variables are always inferred and cannot be specified.