Log In
Or create an account ->
Imperial Library
Home
About
News
Upload
Forum
Help
Login/SignUp
Index
Hack and HHVM
1. Introduction
What are Hack and HHVM?
Who This Book is For
Philosophy
Program Types
Gradual Migration
How The Book is Organized
Versions
Acknowledgements
2. Typechecking
Why Use the Typechecker?
Setting Up the Typechecker
Autoload Everything
Reading Error Messages
Type Annotation Syntax
Function Return Types
Function Parameters
Variadic Functions
Properties
Hack’s Type System
Typechecker Modes
Code Without Annotations
Calling Into PHP
Rules
Using Superglobals
Types of Overriding Methods
Property Initialization
Typed Variadic Arguments
Types for Generators
Fallthrough in switch Statements
Type Inference
Variables Don’t Have Types
Unresolved Types
Inference Is Function-Local
Refining Types
Refining Nullable Types to Non-nullable
Refining Mixed Types to Primitives
Refining Object Types
Inference on Properties
Enforcement of Type Annotations at Runtime
3. Generics
Introductory Example
Other Generic Entities
Functions and Methods
Traits and Interfaces
Type Aliases
Type Erasure
Constraints
Unresolved Types, Revisited
Generics and Subtypes
Arrays and Collections
Advanced: Covariance and Contravariance
Syntax
When to Use Them
Covariance
Contravariance
4. Other Features of Hack
Enums
Enum Functions
Type Aliases
Transparent Type Aliases
Opaque Type Aliases
Autoloading Type Aliases
Array Shapes
Lambda Expressions
Constructor Parameter Promotion
Attributes
Attribute Syntax
Special Attributes
Enhanced Autoloading
Integer Arithmetic Overflow
Nullsafe Method Call Operator
Trait and Interface Requirements
Silencing Typechecker Errors
5. PHP Features Not Supported in Hack
References
The global Statement
Top-Level Code
Old-Style Constructors
Case-Insensitive Name Lookup
Variable Variables
Dynamic Properties
Mixing Method Call Syntax
isset, empty, and unset
Others
6. Collections
Why Use Collections?
Collections Have Reference Semantics
Using Collections
Literal Syntax
Reading and Writing
Iterating
Adding Values
Deleting Values
Operators
Immutable Collections
Type Annotations for Collections
Core Interfaces
General Collection Interfaces
Specific Collection Interfaces
Concrete Collection Classes
Interoperating with Arrays
Conversion to Arrays
Use With Builtin and User Functions
The sort Builtins
Other Builtins
Non-Builtin Functions
7. Async
Introductory Examples
Async in Detail
Wait Handles
Async and Callable Types
await Is Not an Expression
Async Generators
Exceptions in Async Functions
Mapping and Filtering Helpers
Structuring Async Code
Data Dependencies
Antipatterns
Awaiting in a Loop
The Multi-ID Pattern
Other Types of Waiting
Sleeping
Rescheduling
Polling
Batching
Common Mistakes
Dropping Wait Handles
Memoizing Async Functions
Async Extensions
MySQL
Connecting and Querying
Connection Pools
Query Results
MCRouter and memcached
cURL
Streams
8. XHP
Why use XHP?
Runtime Validation
Secure by Default
How to Use XHP
Basic Tag Usage
HTML Character References
Attributes
Embedding Hack Code
Type Annotations for XHP
Object Interface
Validation
Creating Your Own XHP Classes
Attributes
Attribute Types
Inheriting Attributes
children Declarations
Categories
Context
Async XHP
XHP Helpers
Transferring Attributes
Unique IDs
Managing the class Attribute
XHP Best Practices
No Additional Public API
Composition, Not Inheritance
Don’t Make Control Flow Tags
Attributes vs. Children
Style Guide
Migrating to XHP
Converting Bottom-Up
Getting Around XHP’s Escaping
XHP Internals
The Parser Transformation
The Hack Library
9. Configuring and Deploying HHVM
Specifying Configuration Options
Important Options
Server Mode
Warming Up the JIT
Repo-Authoritative Mode
Building the Repo
Deploying the Repo
The Admin Server
10. hphpd: Interactive Debugging
Getting Started
Evaluating Code
The Execution Environment
Local Mode
Remote Mode
Using Breakpoints
Setting Breakpoints
Breakpoint Expressions and Conditions
Breaking From Code
Navigating the Call Stack
Navigating Code
Managing Breakpoints
Viewing Code and Documentation
Macros
Configuring hphpd
About the Author
Copyright
← Prev
Back
Next →
← Prev
Back
Next →