Facebook releases Hack programming language to help devs speed up coding

Facebook releases Hack programming language to help devs speed up coding

Summary: Facebook releases a new language that strikes a balance between coding fast and fixing errors.

SHARE:

Facebook has made much of being guided by the Hacker Tao. Now, it has its own programming language called Hack designed to help its PHP developers "live the Tao" more purely by coding faster and fixing mistakes on the fly.

Hack joins Facebook's PHP runtime environment, HipHop Virtual Machine (HHVM), which it released in 2012 to marry production and development environments and let its PHP developers take a "just-in-time" approach to building on its PHP code base. Essentially, it let PHP developers debug and tune systems that are running in production. 

But coding fast in production environments has its catches. As Facebook notes, it's got thousands of engineers shipping new code twice a day, and in that environment sometimes common coding mistakes can't be caught until runtime. Ultimately, slowdowns like that could become a bigger problem. 

Hack attempts to strike a balance between fast-paced dynamically typed languages and static languages that allow for error detection but might slow things down.

"Hack reconciles the fast development cycle of PHP with the discipline provided by static typing, while adding many features commonly found in other modern programming languages," Facebook engineers wrote in a post on the social networking site.

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

Facebook said it has already migrated nearly all of its entire PHP code base to Hack and, as it did with HHVM, released an open source version at hacklang.org as part of its HHVM.

According to Facebook, PHP developers that use HHVM needn't worry about Facebook abandoning PHP. It is planning to support it for the long haul and is working to bring it parity with PHP-5.

"HHVM is now a runtime that supports *both* PHP and Hack, so you can start to take advantage of Hack's new features incrementally," Facebook's engineers said.

They also stress that Hack is not just for big projects: "With type information, good error messages, and fast feedback, small codebases can reap the benefits of Hack as well."

Read more on Facebook

Topic: Software Development

Liam Tung

About Liam Tung

Liam Tung is an Australian business technology journalist living a few too many Swedish miles north of Stockholm for his liking. He gained a bachelors degree in economics and arts (cultural studies) at Sydney's Macquarie University, but hacked (without Norse or malicious code for that matter) his way into a career as an enterprise tech, security and telecommunications journalist with ZDNet Australia. These days Liam is a full time freelance technology journalist who writes for several publications.

Kick off your day with ZDNet's daily email newsletter. It's the freshest tech news and opinion, served hot. Get it.

Talkback

0 comments
Log in or register to start the discussion