Hack is a programming language for HHVM that interoperates seamlessly with PHP. Hack 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.
Hack provides instantaneous type checking via a local server that watches the filesystem. It typically runs in less than 200 milliseconds, making it easy to integrate into your development workflow without introducing a noticeable delay.
The basic file structure of a Hack script is similar to a PHP script with a few changes. A Hack file starts with <?hh as opposed to <?php for a PHP script:
<?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();
}
Post a Comment
Post a Comment