fbpx

#General Tech

Facebook’s ‘Hack’ programming language allows for faster, bug-free coding

By  | 

Facebook has rolled out a new programming language called Hack, an open-source language for programmers, which it claims will speed up programming while also making it easier to catch errors in code at a faster pace.

Engineers Bryan O’Sullivan, Julien Verlaguet, and Alok Menghrajani, have been developing ‘Hack’ for the HHVM platform to eliminate errors in its massive codes.

Facebook migrated almost its entire codebase to Hack over the last year. The company has now released an open-source version of Hack for the developers.

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

The key difference in Hack programming language is how it handles checking of data types for consistency. This is the essential feature of any programming language to avoid bugs that can crash a program or deliver unexpected output.

PHP does this checking dynamically, while other programming language such C, does the static typing – a method of checking when a program is compiled, even before it actually runs.

“PHP type system doesn’t do anything until the program is running … you find out about logical errors when the site is live,” Bryan O’Sullivan said. “What Hack does is it checks these kinds of errors ahead of time, before you ship off the computer you’re developing on. You can catch errors quickly.”

O’Sullivan also noted that the company is planning to “work closely with the open-source community,” to further develop the language.