بسم الله الرحمن الرحيم
السلام عليكم ورحمه الله وبركاته
What is the Hack?
Hack's HHVM is a programming language. Hack reconcile rapid development cycle for dynamically typed language with the discipline offered by fixed-writing, while adding many of the features typically found in languages other modern programming.
Hack provides instantaneous type of verification by checking gradually your files as you edit. Usually it runs in less than 200 milliseconds, making it easy to integrate into your development work without introducing a noticeable delay.
Here are some of the important features of the language of the Hack. For more information, see the full documentation, or follow through fast and interactive tutorial.
Type annotations
Allow the type annotations to code because explicitly written on the parameters and variables are a class member and return values.
1 2 3 4 5 6 7 8 9 | <?hh class MyClass { const int MyConst = 0; private string $x = ''; public function increment(int $x): int { $y = $x + 1; return $y; } } |
pharmaceutical
Medicines allow classes and methods that parameters (any kind associated when it is instantiated class or method call) in the same vein as the fixed type languages such as C # and Java).
Medicines allow classes and methods that parameters (any kind associated when it is instantiated class or method call) in the same vein as the fixed type languages such as C # and Java).
1 2 3 4 5 6 7 8 9 10 11 12 | <?hh class Box<T> { protected T $data; public function __construct(T $data) { $this->data = $data; } public function getData(): T { return $this->data; } } |
Nullable types
And it supports nullable types by Hack through the use? The operator or agent. This provides a safer way to deal with the free and very useful values of primitive types that do not usually allow null and one of the values, such as logical and int (using? Logical and? Int, respectively). The operator can be used in any type or category.
Groups
Offering groups of first-class, built-in types of parameters such as vectors (l, based on the index ordered), Map (Lexicon ordered), group (a list of unique values), and a pair (a group based on the index exactly two elements).
Lambdas
Lambdas allow briefly defined functions of the first class.
1 2 3 4 5 6 7 8 9 | <?hh function foo(): (function(string): string) { $x = 'bar'; return $y ==> $x . $y; } function test(): void { $fn = foo(); echo $fn('baz'); // barbaz } |


