强类型版的PHP语言facebook的Hack开发环境搭建教程

我不知道我的系统环境如何,用下面的步骤就装好了


hhvm --version
HipHop VM 2.5.0-dev+2014.03.20 (rel)
Compiler: heads/master-0-gc4b6a793b0d6bc28e63c29151ca0a5c12bbbf856
Repo schema: 0e601f9f2c514001cbe38f215a281d34f36a9a9c


Hack 需要 boost支持。


Installing Boost 1.49

Similarly, HHVM requires Boost 1.49, but Ubuntu 12.04 only ships with 1.48. To get a more recent version, follow these steps:

sudo add-apt-repository ppa:mapnik/boost
sudo apt-get update
sudo apt-get install libboost1.49-dev libboost-regex1.49-dev \
  libboost-system1.49-dev libboost-program-options1.49-dev \
  libboost-filesystem1.49-dev libboost-thread1.49-dev
For Ubuntu 12.04:

wget -O - http://dl.hhvm.com/conf/hhvm.gpg.key | sudo apt-key add -
echo deb http://dl.hhvm.com/ubuntu precise main | sudo tee /etc/apt/sources.list.d/hhvm.list
sudo apt-get update
sudo apt-get install hhvm-nightly
装好后,创建一个文件如 first.hack,代码如下:
<?hh

// Hack functions are annotated with types.
function my_negation(bool $x): bool {
  return !$x;
}

// FIXME: annotate this function parameter
// and return with the type 'int'.
function add_one(int $x): int {
  return $x+1;
}

echo add_one(5);
在命令行运行
hhvm first.hack

安装指南

1. https://github.com/facebook/hhvm/wiki/Building-and-installing-HHVM-on-Ubuntu-12.04

关键词: hack安装

上一篇: Facebook发布Hack 语言
下一篇: linux(centos)系统一个网卡绑定多个IP地址方法

目前还没有人评论,您发表点看法?
发表评论

评论内容 (必填):