Facebook Inc (NASDAQ:FB) has launched a new programming language called Hack. Hack is an open-source language for programmers that was used internally over the past year. It will help developers program faster and find errors at a faster pace. Hack was developed for the HHVM platform and is friendly with PHP.
The picture below is an example of how Hack can be beneficial for developers. The code shows a common mistake where a method could unexpectedly be called on a null object, which causes an error that wouldn’t be caught until runtime.
“Every PHP programmer is familiar with day-to-day tasks that can be tricky or cumbersome. The code above is a great example of a common mistake where a method could unexpectedly be called on a null object, causing an error that wouldn’t be caught until runtime. Another example is a complex API, where developers may have a solid understanding of its semantics but still spend time looking up mundane method names in documentation,” said Facebook in a blog post.