Facebook’s Hack Programming Language, Quick Introduction

19 בMay 2014

tags: , ,
one comment

A few days ago, Facebook has announced the release of Hack, a PHP based programming language as an open source project. Let’s take a look into the new kid in the block.

What will be hack’s market share?

PHP is used in leading content management systems like Drupal and WordPress, Facebook’s website is PHP based along with 240 million other websites (about 39% out of all) [1]. It takes 3.3% of the programming language market, and much more relevant, 80% of server side programming language[2], giving Hack a large market \ user base potential.

The Compiler

Hack is a PHP based programming language running on the Hip Hop Virtual Machine, released in 2010 HVVM is a C & C++ based VM that compiles PHP into intermediate byte code code. “This byte code is then translated into x64 machine code dynamically at run time by a just-in-time (JIT) compiler. “

The Motivation

In my perspective, much like TypeScript for javascript, Hack is here to protect the developers from themselves, trying to convert runtime errors into compile time errors. As described in their blog post  Facebook has created Hack simply to increase productivity and reduce common runtime errors.

The Features

The main and most important feature is static typing: loosely method signatures and variables types are error prawns stuff in dynamic languages such as PHP, so finding the way to enjoy this statically typed languages feature into Hack looke a great idea.

PHP vs Hack

A list of other features: generics, nullable types, type aliasing, constraints on type parameters, lambda expressions, collections, etc. More about the features and how the “type checker” algorithm to implement the static typing here.

One more feature which I found interesting is the “Hackificator”, a conversion tool for an existing PHP project into Hack. Facebook has converted their entire system into Hack using the homemade tool.

Windows Is Not Supported

I wanted to check out Hack in my Windows 8 based home machine, but was surprised to see it is not supported:


Hack has a huge advantage with the the multi-billion company pushing it forward, and it should be interesting to see where will they lead it to. Although in my opinion Hack is not a ‘game changer’, it has enough treats to justify a further look. As a Microsoft user, I am uncomfortable with the lack of support for Windows OS at this point and hope the people in Facebook will come to their senses quickly.

More about Hack can be found in GitHub project and in Hack’s official website.

Add comment
facebook linkedin twitter email

Leave a Reply

Your email address will not be published.

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>


one comment

  1. Ereli16 בMay 2014 ב 3:41 pm

    Facebook probably doesn’t have any servers running Windows Server.
    Even Microsoft is now offering your to use Linux to run your servers.
    for your personal computers, you can easily install Ubunto or Fedora inside Virtualbox, Vmware, or Microsoft’s Virtual PC.