Social media leader Facebook has released a new open-source language called Hack. It integrates with the ever-popular language PHP and it’ll allow Facebook engineers write code faster while more easily avoiding common programming errors.
One of the best features of Hack is the ability to combine elements of static web page coding and dynamic languages, such as Ruby or PHP. Some engineers have said that Hack is actually “a new version of PHP.” However, the big difference from Hack to PHP is that it allows “gradual typing” which is a combination of static and dynamic typing.
The gradual typing means that static code can be added into dynamic code and vice versa. This allows a coder to work on both code snippets and improve either one or both at the same time. Until now, there really hasn’t been a language that allowed gradual typing, which makes the new language have “industrial strength.” And most importantly, the new language has been built to detect early mistakes before the runtime occurs and which is sometimes seen only with static programming languages.
Facebook engineer Gabe Levi has said that the new language Hack allows “faster coding.” Features of Hack include: adding safety nets, adding language features, ease of code conversion from PHP, and the ability to run side-by-side with PHP to allow a gradual progression to total code conversion.
By using Hack, Facebook engineers now can easily create much more precise code and code with a lot less flaws because Hack runs without the need to be compiled first; rather an engineer can add code, refresh the page and immediately see the changes without any delays like there would be if they were solely working with a language such as PHP.
Facebook has already migrated its newly released open source language into its PHP-based website. On the other side, as Facebook has released Hack as “open-source“, any engineer or programmer can add to the language or improve on it. This should also invite more integration with third-party app creators and contributors to Facebook add-ons.