Hack Codegen is a library that allows users to generate Hack code, the company’s programming language developed for HipHop Virtual Machine. (HHVM is a virtual machine designed to execute programs in Hack and PHP.) As said above, Hack is a programming language that Facebook developed for its HipHop Virtual Machine (HHVM) that interoperates with PHP programming language. Hack reconciles the fast development cycle of PHP with the discipline provided by static typing, while adding many features commonly found in other modern programming languages, Facebook engineers said.Hack provides instantaneous type checking by incrementally checking a developer’s files as they edit them. It typically runs in less than 200 milliseconds, making it easy for developers to integrate it into their development workflow without introducing a noticeable delay. Before Hack Codegen, Facebook generated code through concatenating strings which it found that it wasnt enough to scale up. The lack of scaling facilities motivated the engineering team to work to complete the Hack Codegen project. Over the year and a half, Facebook migrated nearly its entire PHP codebase to Hack, thanks to both organic adoption and a number of homegrown refactoring tools.“After seeing so much internal use of Hack Codegen for diverse applications, it’s our pleasure to open-source this library for the external community to use,” Marcu said. The technology can be found here.“It is interesting that we are getting back into automated code generation which was a big deal in a different era,” Hilwa said. “I think Codegen is a valuable new tool that can help developer productivity in the right settings. The issues typically for automated code generation have typically been learning the abstraction itself, and then the ability to accommodate changes in the generated code. Newer technologies are constantly innovating around these issues.” The library includes hack_builder to deal with the concatenation, new lines, indentation, braces, hack keywords, and collections, as well as signed files to regenerate code automatically when a schema is changed.