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. yii组态 redis主从配置(随着代码)

    最近的欲望redis 主从,但yii内建的redis 它不支持主从.不仅写了一个好办法 结构例,以下: 1.main.php通过添加下面的句子: //redis缓存配置 'cache_redis' = ...

  2. Unity项目优化--开发项目的小经验

    原文地址:http://blog.csdn.net/liang_704959721/article/details/8548619 我们主要使用 3dsmax2010 进行制作,输出 FBX的类型导入 ...

  3. C#中实现并发

    C#中实现并发的几种方法的性能测试 0x00 起因 去年写的一个程序因为需要在局域网发送消息支持一些命令和简单数据的传输,所以写了一个C/S的通信模块.当时的做法很简单,服务端等待链接,有用户接入后开 ...

  4. [ACM] poj 1088 滑雪 (内存搜索DFS)

    滑雪 Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 73409   Accepted: 27141 Description ...

  5. NSIS:卸载加密码示例

    原文 NSIS:卸载加密码示例 最近有几个同学问我关于卸载时加密码的问题,其实很简单,懂点基础就可以根据安装加密码那篇文章http://www.flighty.cn/html/bushu/201009 ...

  6. Linux Kernel系列 - 黄牛X内核代码凝视

    Hanks.Wang - 专注于操作系统与移动安全研究.Linux-Kernel/SELinux/SEAndroid/TrustZone/Encription/MDM    Mail - byhank ...

  7. Java并发编程:线程池的使用(转)

    Java并发编程:线程池的使用 在前面的文章中,我们使用线程的时候就去创建一个线程,这样实现起来非常简便,但是就会有一个问题: 如果并发的线程数量很多,并且每个线程都是执行一个时间很短的任务就结束了, ...

  8. TDD和BDD

    开发人员看测试之TDD和BDD   前言: 已经数月没有来园子了,写博客贵在坚持,一旦松懈了,断掉了,就很难再拾起来.但是每每看到自己博客里的博文的浏览量每天都在增加,都在无形当中给了我继续写博客的动 ...

  9. hdu 3695 Computer Virus on Planet Pandora(AC自己主动机)

    题目连接:hdu 3695 Computer Virus on Planet Pandora 题目大意:给定一些病毒串,要求推断说给定串中包括几个病毒串,包括反转. 解题思路:将给定的字符串展开,然后 ...

  10. oracle----sqlldr用法(转)

    SQL*LOADER是ORACLE的数据加载工具,通常用来将操作系统文件迁移到ORACLE数据库中.SQL*LOADER是大型数据仓库选择使用的加载方法,因为它提供了最快速的途径(DIRECT,PAR ...