Summary

Hack provides the following, non-exhaustive list of features:

  • Ability to annotate function and method return types.

  • Ability to annotate the type of member variables.

  • Protection against common unsafe coding patterns (e.g. sketchy null checks).

  • Type-safe collections (Vector, Map, Set).

  • A tool to check the types (the Hack type checker).

Hack has been designed with PHP compatibility in mind. The type checker enforces checks on typed code and assumes calls to/from PHP and other untyped code are correct. This means the amount of type checking will gradually increase as more and more code is written in Hack.

Hack is unlike many other statically typed languages:

  • The type checking phase is instant.

  • Local types are inferred.

  • There is a minimal need for casting.

  • The type related error messages are designed to make it easy to fix the core issue.

  • The type checking model is a best effort model. Hack code can call PHP code and vice versa.

Hack comes with the following benefits (and possible benefits):

  • Return types makes the code more readable.

  • Some typing mistakes will be caught by the type checker.

  • Better emacs/vim/etc. integration.

  • Future: Reliable refactoring tools.

  • Future: Most typing mistakes will be caught statically.

Hack 语言学习/参考---1.3 Summary的更多相关文章

  1. Hack 语言学习/参考---1.Hack 语言

    Table of Contents What is Hack? Hack Background Summary Hack is a language for HHVM that interopates ...

  2. Hack 语言学习/参考---1.2 Hack Background

    Hack Background Facebook was initially built with PHP. Parameters and return types were specified in ...

  3. Hack 语言学习/参考---1.1 What is Hack?

    What is Hack?¶ Hack is a language for HHVM that interopates seamlessly with PHP. The barrier to entr ...

  4. 学习参考:《Python语言及其应用》中文PDF+英文PDF+代码

    学习简单的数据类型,以及基本的数学和文本操作,学习用Python内置的数据结构来处理数据: 掌握Python的代码结构和函数的用法:使用模块和包编写大规模Python程序:深入理解对象.类和其他面向对 ...

  5. C语言学习 第八次作业总结

    本次作业其实没有新的内容,主要就是复习上一次的一维数组的相关内容.冯老师布置了5道题目,其中涉及到一些比较简单的排序或者是查找的方法.因为数据很少,所以直接使用for循环遍历就可以了. 关于本次作业, ...

  6. HTML语言学习笔记(会更新)

    # HTML语言学习笔记(会更新) 一个html文件是由一系列的元素和标签组成的. 标签: 1.<html></html> 表示该文件为超文本标记语言(HTML)编写的.成对出 ...

  7. linux 下C语言学习路线

    UNIX/Linux下C语言的学习路线.一.工具篇“公欲善其事,必先利其器”.编程是一门实践性很强的工作,在你以后的学习或工作中,你将常常会与以下工具打交道, 下面列出学习C语言编程常常用到的软件和工 ...

  8. 足球运动训练心得及经验分析-c语言学习调查

    在准备预备作业02之前,我参考娄老师的提示,阅读了<[做中学(Learning By Doing)]之乒乓球刻意训练一年总结>一文. 在文章描述的字里行间,给予我的印象是系统.负责,娄老师 ...

  9. 12天学好C语言——记录我的C语言学习之路(Day 7)

    12天学好C语言--记录我的C语言学习之路 Day 7: 昨天进行了一天的数组学习,今天大家可以先写几个昨天的程序热热身,回顾回顾,然后今天第一个新程序也是关于数组的,比较难,准备好就开始啦! //输 ...

随机推荐

  1. DNA和纳米(Nano)Fusion技术的发展趋势

    细观国内外有关DNA与Nano技术的报道.不得不承认存在不小的差距,并且差距有继续拉大的趋势. 在我们国内,DNA技术是作为遗产基因来对待的.引用的有关中文參考资料一般比較陈旧.缺少參考价值.在发达国 ...

  2. Oracle性能分析3:TKPROF简介

    tkprof它是Oracle它配备了一个命令直插式工具,其主要作用是将原始跟踪文件格文本文件的类型,例如,最简单的方法,使用下面的: tkprof ly_ora_128636.trc ly_ora_1 ...

  3. COM Interop

    1.MSDN上的文章:COM Interop教程 2.接口的三种类型:IDispatch.IUnknown和Dual 3.使用TlbImp来更灵活地自动生成RCW 4.托管事件基于委托,而非托管事件( ...

  4. mysql压力测试

    1.采用 mysqlslap  压力测试 mysqlslap  --defaults-file=/etc/my.cnf --concurrency=200 --iterations=1 --numbe ...

  5. dojo加载树错误

    1.错误叙述性说明    error loading undefined children.    TypeError:this._arrayOfTopLevelItems is undefied. ...

  6. IIS7.0 Appcmd 命令详解

    原文 IIS7.0 Appcmd 命令详解 一:准备工作 APPcmd.exe 位于 C:\Windows\System32\inetsrv 目录 使用 Cd c:\Windows\System32\ ...

  7. Android开发之异步具体解释(二)之AsyncTask

    请尊重他人的劳动成果,转载请注明出处:Android开发之异步具体解释(二)之AsyncTask http://blog.csdn.net/fengyuzhengfan/article/details ...

  8. SpringMVC上传下载

    springmvc上传和下载功能 写在一个简单的示例在线基准码 1.导入的必要性jar包:ant.jar.commons-fileupload.jar.connom-io.jar. 当然spring ...

  9. Java一些八卦集合类

    Map 和 Set关系 Map和Set事实基础的朋友,有着千丝万缕的联系. Map它可以被看作是Set延期.从何时起Set内容存储在key-value的值当表单.这个Set实际上可以作为Map使用.反 ...

  10. HDU 2082-找单词(母函数)

    找单词 Time Limit: 1000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Submis ...