1. Hack 是什么?php
Hack 是一种基于HHVM(HipHop VM 是Facebook推出的用来执行PHP代码的虚拟机,它是一个PHP的JIT编译器,同时具备产生快速代码和即时编译的优势。)的新型编程语言,能够实现与PHP的无缝互操做。Hack经过静态编辑确保了PHP的快速开发周期,与此同时又添加其它主流语言的不少通用功能,使其相比于PHP更具优点。编程
Hack经过检索本地服务器的文件系统表提供即时的类型校验,校验耗时一般小于200毫秒,所以它很容易集成到你的开发流程中而不引入明显的延时。数组
下面是Hack语言一些很是重要的特性:安全
1 <?hh 2 class MyClass { 3 const int MyConst = 0; 4 private string $x = ''; 5 public function increment(int $x): int { 6 $y = $x + 1; 7 return $y; 8 } 9 }
1 <?hh 2 class Box<T> { 3 protected T $data; 4 5 public function __construct(T $data) { 6 $this->data = $data; 7 } 8 9 public function getData(): T { 10 return $this->data; 11 } 12 }
<?hh function foo(): (function(string): string) { $x = 'bar'; return $y ==> $x . $y; } function test(): void { $fn = foo(); echo $fn('baz'); // barbaz }
Other significant features of Hack include Shapes, Type Aliasing, Async support, and much more.服务器
Hack其余一些重要特性包括Shapes, Type Aliasing, Async support等。async
更多详细信息请查阅:http://hacklang.org/编程语言