March 21, 2014
Facebook Unveils New Programming Language: Hack
Enid Burns for redOrbit.com - Your Universe Online
Facebook is the company behind a new programming language called Hack, which currently serves 1.2 billion people as the social network already uses the new programming language for all of its websites. Facebook plans to offer Hack as open source code and has provided details at hackland.org.
The language uses what Facebook calls HHVM, an open-source virtual machine. The machine is designed to execute programs written in Hack and PHP. The programmers claim that the language is faster, as it uses a just-in-time compilation approach. Details are offered in a post on the HHVM blog.
Engineers Bryan O'Sullivan, Julien Verlaguet and Alok Menghrajani led a team at Facebook over the past few years to develop Hack, reports Wired's Cade Metz.
During development, Facebook and its associated websites proved to be a perfect testing ground. "We can say with complete assurance that this has been as battle-tested as it can possibly be,” O'Sullivan told Metz. O'Sullivan has experience beyond Facebook. He previously worked at tech companies such as Sun Microsystems and Linden Lab. He is also involved in the development of the programming language Haskell.
O'Sullivan's experience, as well as those on his team, help give the new programming language instant credibility, Metz reported. "The software world is littered with programming languages, and new ones appear all the time. But according to some who have used it or who know the past work of those who built it, Hack has a design and a pedigree that immediately set it apart."
"If Bryan O’Sullivan built it, I would walk across hot coals to use it." programming guru David Pollak, who only yesterday heard about the new language, told Metz.
Beta code is now live and available at Hackland.org, VentureBeat reports. Programmers say the new language streamlines PHP, and works faster.
"Company engineers said inherent challenges in the PHP code sometimes made simple tasks 'tricky or cumbersome' and that coding errors were sometimes not detected until the script had gone live. Hack has changed that, Facebook said. Thus, the company said, 'Hack was born'," wrote Richard Byrne Reilly of Venture Beat.
According to Reilly, some of the embellishments to PHP were explained by Facebook:
“Our principal addition is static typing. We have developed a system to annotate function signatures and class members with type information; our type checking algorithm (the type checker) infers the rest. Type checking is incremental, such that even in the same file, some code can be converted to Hack while the rest remains PHP. Technically speaking, Hack is a gradually typed language: dynamically typed code interoperates seamlessly with statically typed code.”
“The Hack adds additional features beyond static type checking, including collections, lambda expressions, and run time enforcement of return and additional parameter types...We are delighted to open-source both Hack and the tools that we used to convert our codebase.”
Those "tricky and cumbersome" tasks to clear up PHP code are magnified on larger websites, Stephanie Mlot of PCMag reports. "At Facebook scale — with thousands of engineers shipping new code twice a day — slowdowns like these are even more problematic," Verlaguet wrote in a blog post.
Facebook plans to host a Hack-related event at its campus next month.