Hack is a programming language introduced by Facebook[1] on March 20, 2014. It was implemented and tested on a significant portion of Facebook’s site web[2] prior to its official announcement. Hack is designed to work seamlessly with PHP, extending type hinting from PHP5 by introducing static typing. It uses a gradual typing system where type annotations are not mandatory by default. However, a strict mode in Hack mandates type annotations for sound code. Some less common PHP features are not supported in Hack. The structure of Hack scripts is similar to PHP, but with some key differences. For instance, Hack files do not use the `
Hack est un programming language for the HipHop Virtual Machine (HHVM), created by Méta (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 | Métaplateformes |
First appeared | 2014 |
Typing discipline | Static, dynamic, weak, gradual |
OS | Cross-platform |
License | MIT License |
Site web | hacklang |
Influenced by | |
PHP, OCaml, Java, C#, Scala, Haskell |
Hack allows programmers to use both dynamic typing et 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 valueset class properties; however, types of local variables are always inferred and cannot be specified.