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."


Explore further

Dutch ponder giving police the right to hack

More information: hacklang.org/

© 2014 Phys.org

Citation: Facebook releases Hack programming language for HHVM (2014, March 23) retrieved 19 September 2019 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.
832 shares

Feedback to editors

User comments

Mar 23, 2014
Better solution. If you want ObjC characteristics in PHP then help steer the language. Coming out with a PHP step-child doesn't cut it.

Or just cut the bs and admit you want to use C++, because 90% of that syntax is C++.

Mar 24, 2014
Reminds me of Microsoft and the transmogrification of BASIC into VB. Also Google, Go, Dart, and me too.

Looks like a niche language that suggests the focus of its creators. Probably not useful for parallelizing Navier-Stokes simulations, or running faster FFTs, for instance.

Please sign in to add a comment. Registration is free, and takes less than a minute. Read more