ENTRIES TAGGED "hack"

Facebook’s Hack, HHVM, and the Future of PHP

What is Hack and what does it mean for the future of PHP?

Photo: thebusybrain https://www.flickr.com/photos/thebusybrain/3283201861/
Facebook recently released Hack, a new programming language that looks and acts like PHP. Underneath the hood, however, are a ton of features like static typing, generics, native collections, and many more features for which PHP developers have long been asking. Syntax aside, Hack is not PHP. Hack runs only on Facebook’s HipHop virtual machine (HHVM), a competitor to the traditional PHP Zend Engine.

Why did Facebook build Hack?

Much of Facebook’s internal code is first written with PHP. Facebook can onboard new developers quickly with PHP because the language is notoriously easy to learn and use. Granted, much of Facebook’s PHP code is likely converted to a C derivative before being pushed into production. The point is Facebook depends strongly on the PHP language to attract new talent and increase developer efficiency.

Strict Typing

Unfortunately, PHP may not perform as well as possible at Facebook’s scale. PHP is a loosely typed language and type-related errors may not be recognized until runtime. This means Facebook must write more tests early to enforce type checking, or spend more time refactoring runtime errors after launch. To solve this problem, Facebook added strict typing and runtime-enforcement of return types to Hack. Strict typing nullifies the need for a lot of type-related unit tests and encourages developers to catch type-related errors sooner in the development process.

Instantaneous Type Checking

To make the development process and error-catching process even easier, Facebook includes a type-checking server with its HHVM engine. This server runs locally and monitors Hack code as it is written. Developers’ code editors and IDEs can use this type-checking server to immediately report syntax or type-related errors during code development.
Read more…

Comments: 3 |
Science Hack Day goes global

Science Hack Day goes global

A new grant will help Science Hack Day set up shop around the world.

The just-announced Science Hack Day Ambassador program will bring 10 people to Science Hack Day San Francisco 2011. The idea is to spread the model to more cities and countries.

Comment |
Video pick: The inevitable merging of Kinect and “Minority Report”

Video pick: The inevitable merging of Kinect and “Minority Report”

Kinect + open drivers + MIT = the future of UI.

A marriage of Kinect and the creativity of MIT has led to this: The first baby steps toward "Minority Report"-inspired interfaces.

Comments: 3 |