Facebook unveils Hack, a new programming language for writing code faster

Facebook campus generic

Facebook is at it again, introducing a new programming language designed to make the process of writing and testing code faster. Called Hack, it has been in use for a year at the social networking company, and on Thursday Facebook released it as open source.

Hack is a programming language that Facebook developed to combine elements of static-type programming languages such as C with dynamic-type languages like PHP. When you code in a static programming language it will let you know when you have an error before the program runs, but in the more modern, dynamic type language you code until the program crashes. Facebook is a PHP house, but Bryan O’Sullivan, manager of the Hack team, said that with many developers working on a variety of projects, the benefits of being able to catch errors before running the program began to make sense. It let developers code faster, which may be just as important as writing code that runs faster when you ship as much code as Facebook.

From the Facebook blog post:

Traditionally, dynamically typed languages allow for rapid development but sacrifice the ability to catch errors early and introspect code quickly, particularly on larger codebases. Conversely, statically typed languages provide more of a safety net, but often at the cost of quick iteration. We believed there had to be a sweet spot.

Thus, Hack was born. We believe that it offers the best of both dynamically typed and statically typed languages, and that it will be valuable to projects of all sizes.

So, in typical Facebook fashion a couple of engineers got together to build what O’Sullivan called a gradual-type language that became Hack. Facebook has been running Hack for a year alongside PHP and plans to gradually migrate as much of its new code as possible to Hack. O’Sullivan said Hack has no affect on how fast the code runs.

As for who might use this given that Facebook has made it open source, O’Sullivan says, “You might think this is only important to large companies, but the actual fact is small teams and individual developers could use this too so we think this could be beneficial to a large number of people.

loading

Comments have been disabled for this post