Facebook Reveals ‘Hack,’ the Programming Language of the Future.

0

Facebook Reveals ‘Hack,’ the Programming Language of the Future.

Apparently the recent “HACK” signs that have been recently placed around the walls of Facebook aren’t just some sort of command demanded from Zuckerberg himself. The social networking site has recently been using a programming language that been called “Hack” and it has recently been released to the world.

The New Language.

Facebook has described Hack as “a programming language we developed for HHVM that interoperates seamlessly with PHP” and “… 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.”

 The social media site has already commented on the various uses Hack has been done with, and they prefer this language more then other, due to its reducing the chances of simple-to-make errors that usually hamper the development process..

“Traditionally, dynamically typed languages allow for rapid development but sacrifice the ability to catch errors early and introspect code quickly, particularly on larger codebases,” Facebook writes. “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.”

“Thus, Hack was born. We believe that it offers the best of both dynamically typed and statically typed languages, and that it will be valuable to projects of all sizes.”

Hack seems to be a subset of PHP and Facebook has said ” most PHP files are already valid Hack files.”

Featured Language.

Features of the new language , which are said to be simply amazing include:

  • Type Annotations allow for PHP code to be explicitly typed on parameters, class member variables and return values;
  • Generics allow classes and methods to be parameterized (i.e., a type associated when a class is instantiated or a method is called) in the same vein as statically type languages like C# and Java);
  • Nullable Types are supported by Hack through use of the ? operator. This introduces a safer way to deal with nulls and is very useful for primitive types that don’t generally allow null as one of their values, such as bool and int (using ?bool and ?int respectively). The operand be used on any type or class;
  • Collections enhance the experience of working with PHP arrays, by providing first class, built-in parameterized types such as Vector (an ordered, index-based list), Map (an ordered dictionary), Set (a list of unique values), and Pair (an index-based collection of exactly two elements);
  • Lambdas offer similar functionality to PHP closures, but they capture variables from the enclosing function body implicitly and are less verbose.

Samples of the code to prove listed statement above can be found at the new hacklang.org site created in order to promote the language and host the open source needed to spread Hacking towards others.

Facebook also announced it would be throwing a developed day for possible future Hacker users, capable of getting themselves into Menlo Park on April 9th.

Share.

About Author

Kevin is passionate about startups and loves to write about them. Previously Kevin ran a design studio. Now he loves to write about tech and startups.

Entrepreneur Sky @Copyright 2014