Original URL: https://www.theregister.com/2014/03/21/facebook_hacks_out_php_alternative/

Facebook hacks out PHP alternative

'Hack' language brings best bits of other languages to LAMP-land

By Simon Sharwood

Posted in Software, 21st March 2014 05:02 GMT

The big “HACK” signs reputed to adorn the walls of Facebook offices aren't just a command from His Royal Zuckness: The Social Network also uses a programming language called “Hack” and has just given it to the world.

Facebook describes 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 Network says it already uses Hack for all sorts of things, and likes it because it reduces the likelihood of simple-to-make errors that slow 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 superset of PHP and Facebook says “most PHP files are already valid Hack files.”

Features of the new language said to be especially cunning include:

Code samples to prove the assertions above can be found at the new hacklang.org site erected to promote it and host the open sourcery needed to get Hacking yourself.

Facebook is also throwing a developed day for would-be Hackers capable of getting themselves to Menlo Park on April 9th. ®