Facebook gives own php-based programming language free

0
233

Facebook has a programming language released that both dynamic and static typing support. The language, with the name Hack, is largely compatible with php and makes it possible to statically typed code to run without the need to be compiled.

The programming language is all for the vast majority of Facebook use, but are only now to the world shown. The developers of the programming language have him released as open source. Hack works in combination with Hip-hop, a combination of a just-in-time compiler and a virtual machine that already through Facebook under an open source license was released.

What is the programming language special is that he is both dynamic and static characterizations supports. Languages with dynamic characterizations, such as php and Ruby make it easier to write code, while languages with static characterizations such as Java, more stable, more manageable code. Hack supports both next to each other, enabling new features, for example, first may be dynamically built and, later, static characterizations can be provided.

Hack leans for a very large part in php: the most php files can be even without changes as a Hack-scripts to be rotated. However, some uitgefaseerde php functions are not supported, as well as some features that are incompatible with static characterizations proved. Particular is that Hack makes it possible to code with static characterizations to run without the need for the code to compile.

Facebook also has tools released to code with dynamic characterizations to statically typed code. The social network that the tools used to code largely to Hack to convert. Facebook turned since its creation in php.

<?hh
class MyClass {
public function alpha(): int {
return 1;
}

public function beta(): string {
return ‘hi test’;
}
}

function f(MyClass $my_inst): string {
// Fix me!
return $my_inst->alpha();
}

Example of code in Facebook Hack