Hack Documentation
Getting Started
Getting Started
Installing Hack, running your first program, and introducing the tools.Source Code Fundamentals
Basic syntax, namespaces, and the autoloader.Expressions And Operators
Expressions, operators, associativity, and precedence.Arrays And Collections
Immutable collections, mutable collections, and APIs.Contexts And Capabilities
Specifying capabilities and permissions for functions.Modules
Language support for organizing code.Packages
Combine modules into separate builds and deployments.XHP
Safe, composable HTML templating.Silencing Errors
HH_FIXME best practices and error codes.Contributing
How to contribute to this website.
Control Flow
Statements
Simple statements, blocks, and loops.Asynchronous Operations
Asynchronous functions, await, and the concurrent keyword.Readonly
Specialized feature for performantly controlling object mutability
Classes, Interfaces, Traits
Functions
Named functions, anonymous functions and parameters.Classes
Classes provide a way to group functionality and state together.Traits And Interfaces
Mechanisms for code reuse and code constraint within classes.Attributes
Attaching metadata to Hack programs, built-in attributes and defining your own.
Types and Generics
Types
The type checker.Built In Types
Built-in types known to the type checker.Generics
Generic types, where constraints, and variance.Reified Generics
Generics with type information accessible at runtime.
Experimental Additions
Experimental Features
Enable features in the experimental phase.Expression Trees
Typechecker support for domain specific languages.Memoization Options
Experimental feature for controlling use of memoization and the Implicit Context
Built-in API Reference
Full reference docs for all functions, classes, interfaces, and traits in the Hack language.
Standard Library API Reference
Full reference docs for all functions, classes, interfaces, and traits in the Hack Standard Library.