微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

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

原文链接http://www.cnblogs.com/Jack8Chen/p/3620802.html

What is Hack? ¶

Hack is a language for HHVM that interopates seamlessly with PHP. The barrier to entry for Hack is low. To get started, all that is needed is to generally understand the features that Hack provides and how to call the Hack type checker(hh_client invokes the type checker at the command line)

The goal of Hack to offer developers a way to write cleaner, safer and refactorable code while trying to maintain a level of compatibility with current PHP codebases. The primary way that this goal is achieved is to provide developers a way to annotate PHP functions and classes with type information, providing a type checking tool to validate those annotations. In addition, Hack also provides specific language feature additions such as:

Each of the Hack features, and more, is discussed in great detail in this documentation.

Hack code is indicated through the <?hh marker at the top of a file, as opposed to the canonical <?PHP marker.

Very important note: The type checker is invoked before runtime to determine whether code is typesafe. While HHVM kNows about and understands the Hack language, it does not necessarily strictly enforce them. This is different from a true statically-typed language like C# where code is type checked at compile time and enforced (usually via some sort of exception mechanism) at runtime.

转载于:https://www.cnblogs.com/Jack8Chen/p/3620802.html

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐