CrazyEngineers
  • 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
Howdy guest!
Dear guest, you must be logged-in to participate on CrazyEngineers. We would love to have you as a member of our community. Consider creating an account or login.
Replies
Home Channels Search Login Register