Facebook releases Hack programming language for HHVM

Facebook releases Hack programming language for HHVM
Credit: FB

(Phys.org) —Facebook this week unveiled Hack, a programming language they had in use for a year but have now released as per an official announcement posted on the engineering blog on Thursday. What's in it for programmers?

The verdict from numerous tech sites has been that Hack signals much good news. Writing and testing code for Facebook is made faster. The Hack team called it a for HHVM (stands for the HipHop Virtual Machine, an open-source virtual machine designed for executing programs written in Hack and PHP). They already deployed Hack at Facebook. "Over the last year, we have migrated nearly our entire PHP codebase to Hack." Hack has deep roots in PHP, they said. In fact, most PHP files are already valid Hack files. (As GigaOM reported Thursday, 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.) What's the big deal? To appreciate the big deal about Hack, the team's description of programming difficulties is useful, keeping in mind that slowdowns are no joke when working on Facebook-scale, which involves, said the posting, thousands of engineers shipping new code twice a day.

"Every PHP programmer is familiar with day-to-day tasks that can be tricky or cumbersome," they said. They gave an example of a common mistake where a method could unexpectedly be called on a null object, causing an error that would not be caught until runtime. "Another example," they said, "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."

Slowdowns, though, had no easy fix. The question was speed at what cost. Early error detection, it seemed, could not coexist with rapid iteration with dynamically typed language. "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."

The sweet spot is called Hack. "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."

They have released an open source version of Hack to the public at hacklang.org/ as part of their HHVM runtime platform, which will now support both Hack and PHP..

Next month, Facebook intends to introduce the language, too, at Hack Developer Day on the Facebook campus in Menlo Park.

Hack is written primarily in OCaml, which is a programming language developed by researchers at INRIA, or French Institute for Research in Computer Science and Automation, billed as being used in environments "where a single mistake can cost millions and speed matters."

More information: hacklang.org/

© 2014 Phys.org

Citation: Facebook releases Hack programming language for HHVM (2014, March 23) retrieved 29 March 2024 from https://techxplore.com/news/2014-03-facebook-hack-language-hhvm.html
This document is subject to copyright. Apart from any fair dealing for the purpose of private study or research, no part may be reproduced without the written permission. The content is provided for information purposes only.

Explore further

Dutch ponder giving police the right to hack

832 shares

Feedback to editors