Introducing Hack – A Programming Language for HHVM

Posted on March 20, 2014 by

As you may have heard or seen already, the Hack programming language has been released for HHVM. 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.

We have deployed Hack at Facebook and it has been a great success. Over the last year, we have migrated nearly our entire PHP codebase to Hack, thanks to both organic adoption and a number of homegrown refactoring tools.

We are proud to release an open source version of Hack to the public as part of our HHVM runtime platform, which will now support both Hack and PHP.

It is important to note that we have developed Hack to interoperate as seamlessly as possible with PHP. In fact, it is a stated goal of the HHVM team to continue to grow compatibility with the many existing PHP frameworks. The top 20 open source frameworks on Github run on HHVM. We currently pass 9 10 of the top 20 at 100% on their unit tests. Most of the others are passing at or above 90%. We, of course, are working hard to ensure every framework is at or near 100%.

You can view the complete Hack language announcement or go directly to http://hacklang.org to find out more. Enjoy!

Posted in Announcement, Hack Language | Leave a reply

17 Responses to “Introducing Hack – A Programming Language for HHVM”

  1. James Pearce says:

    This is very exciting. Congratulations to all involved.

  2. […] has just released the Hack documentation and tools that we have been using on some projects and our Hack-specific […]

  3. First, congratulations!

    Is there a performance difference between using pure PHP and Hack? I’m wondering if it is worth making Hack a Haxe target? [now that is confusing]

  4. patlecat says:

    Can you please support openSUSE? I need it with Yii-Framework. Windows would be nice too for development (with XAMPP).

  5. Omar Jackman says:

    I think this is very cool but why did you choose this syntax versus the java style approach of:

    public string function foo(){
    return ‘Some String’;
    }

    I’m not saying it’s wrong, bad or anything else negative I’m just wondering what swayed you in this irreversible direction versus another.

  6. Probably the most expected feature from the HHVM team :-)

    I’m waiting for integration with my favorite IDE, but will indeed start experimenting with HACK in the next days. Awesome, thanks!

  7. Julien Verlaguet says:

    Omar:

    There was multiple options, let’s review them.
    int function foo() …

    This option would have been consistent with the C tradition. The problem is that we have closures too, and it would have been very hard to make the type annotation fit in that particular place for closures.

    When one writes:
    $x = int function( …
    That’s difficult to parse, especially if the type can be something complex like Vector etc …
    We knew that we wanted to expand the type-system, add new types and that each time, adapting the parser for closures would be painful. So we decided not to put them there.

    Second option: function int foo(…)
    Internally, we have many people and tools “grepping” for functions, the way they do that is by typing: grep “function foo”.
    It would not have been the end of the world to put it there, but it would have been somewhat painful.

    That’s why we put the type annotation last. I hope this answers your question.

  8. Isaac says:

    Do you have any plugins for Eclipse or other IDEs that provide the hh_client’s feedback inline with your code?

  9. Radu says:

    Hey guys, small issue: your blog’s RSS feed URL (http://hhvm.com/blog/feed/) doesn’t work anymore.

    Was it changed to something else ? If yes, where can I find it ?

    Thanks.

  10. Adrian Budau says:

    Is there support for hack with libphutil? I suspect not considering I ahven’t seen any big updates to the XHPAST parser.

    So if not, will there be added in the future?

    Thanks :-)

  11. […] is faster, as it uses a just-in-time compilation approach. Details are offered in a post on the HHVM blog. Read more at […]

  12. […] début de soirée,  Pascal Martin nous parlera d’HHVM et de Hack. Il nous fera un petit historique d’HHVM, puis indiquera la façon de l’installer et de […]

  13. Joseph Rex says:

    I find this really interesting as you guys at Facebook are making great contributions to the open source community

  14. Amachree says:

    I don’t like the semantic of this language

  15. “Hack” is not a new programming language. It is an annotation-based type-checking and type-tracking system on top of PHP that has no runtime implications save for the collection classes being added. No matter how much it integrates with PHP syntax, and no matter how much weird stuff it introduces (Nullable types? Really?) there are no changes to the runtime of PHP and these features (like the Nullables) just serve to confuse any programmer who no longer can intuit what his code is REALLY doing.

    And the problem is not the type-checking. It is not even the hideous generics (like in Java). It is not even the Nullables. It is the fact that the presentation of these features is done in a way that makes people believe (or tries to confuse them into believing) that these are really additions to the PHP language when they are not.

    And this also has implications (much like in Java) for the way these syntaxes are developed and chosen. The syntax itself can serve to confuse people into believing that we are talking about core language features.

    And it is just a type-tracking type-checking warning-generating system. Nothing more. I haven’t checked all of the features thoroughly (like Shapes) but all of it seems parse-time and most of it seems incongruent and ill-designed because of the initial, basic, erroneous decision to treat it as a “language” instead of as an “annotation system” for that language (which is PHP).

Leave a Reply