zoukankan      html  css  js  c++  java
  • 兴奋、强类型版的PHP语言

    Hack 是 Facebook 推出的一款新的编程语言。

    Hack 是由Facebook开发的,同时结合了动态类型语言(如C语言)和静态类型语言(如PHP语言)两种特点的一种编程语言。通常在使用静态类型语言编程 时,开发者会在程序被运行前就知道错误发生的位置。而在更为当前的编程环境里,动态类型语言会一直运行到直至程序出错崩溃。

    http://static.cnbetacdn.com/newsimg/2014/0321/25_1jaT3fMDO.png

    特性:

    • 该语言将能使代码的编写和测试更加高效快速,能够在程序运行前捕获到其中的错误;
    • 同时结合了动态类型语言(如PHP语言)和静态类型语言(如C语言)两种特点;
    • Hack对代码本身的运行速度并没有实质影响;
    • 基于hhvm(hiphop vm)运行

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

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

    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

    2. http://zendframework.info/tag/hhvm-2/

  • 相关阅读:
    react-router刷新页面Cannot GET 问题
    react学习之弹出层
    react学习之js-xlsx导入和导出excel表格
    c#串口通信并处理接收的多个参数
    react与微信小程序
    promise知识点小结
    汇编命令小记
    Firebase-config 在android中的使用
    python:html元素解析
    Toast实现源码解析
  • 原文地址:https://www.cnblogs.com/x3d/p/3615068.html
Copyright © 2011-2022 走看看