Facebook's Hack Programming Language Has Deep Roots In PHP; Features Static Typing

Facebook engineers have launched a new programming language called 'Hack' that uses PHP's fast development cycle and brings in a host of new features including static typing. The open source Hack Language has been deployed at Facebook for some time now and the developers at Facebook have been successful in migrating their entire PHP codebase to Hack using the company's very own refactoring tools and organic adoption techniques. The need for a new language was felt because the traditional dynamically typed languages lack the ability to identify errors early and introspect code quickly on large database systems. Whereas, the statically typed languages didn't offer fast iteration, but were quite safe. The company came up with 'Hack' to overcome these shortcomings by finding a solution that offered the best of both worlds.

With the static typing feature, Hack language annotates function signatures and class members with type information. In computer science terms, Hack is a “gradually typed” language, because with it dynamically typed code interoperates seamlessly with statically typed code. Among other features - there's generics, nullable types, type aliasing, constraints on type parameters.

Facebook-Hack
Type Annotations allow for PHP code to be explicitly typed on parameters, class member variables and return values. Collections enhance the experience of working with PHP arrays, by providing first class, built-in parameterized types such as Vector, Map, Set and Pair. Lambdas are just like the PHP closures, but they can capture variables from the enclosing function body implicitly and are low on verbose. While, Generics allow classes and methods to be parameterized. Run-time enforcement of return types and parameter types helps programmers detect and diagnose certain kinds of problems more easily.

Next month, Facebook is also introducing the 'Hack' language at the Hack Developer Day on the Facebook campus in Menlo Park. How do you like the

Source: #-Link-Snipped-#

Replies

  • Madhava Verma Dantuluri
    Madhava Verma Dantuluri
    Well, its openly been in usage now.

You are reading an archived discussion.

Related Posts

Hi this is martin from pune, india. I want to study mechanical engineering, but the problem is my eyesight is very poor. I also have glaucoma in one eye. When...
With Microsoft ending support for the long cherished XP OS, the company has now offered $100 (approx. Rs. 6100) discount and a load of freebies for a user migrating from...
why these tmp file create and what is effect on our computer system?
Post Removed
I had to field pure science questions on the only two interviews I faced for my first two jobs. The rest were offered. It is amazing what questions do get...