- The Hack Language
- What is Hack?
- Hack Background
- Summary
- Type Annotations
- Introductory Example
- Why?
- What types can be used?
- How to type annotate
- Examples
- Type Casting
- Annotating Arrays
- Annotating Closures
- Annotating Constructors
- Annotating with this
- Mixed Types
- Passing By Reference
- Typing Generators
- Summary
- Hack Modes
- Strict
- Partial
- Decl
- Unsafe
- Generics
- Introductory Example
- Writing a Generic Class
- Writing a Generic Trait and Interface
- Writing a Generic Method
- Generics and Type Inference
- Override on Return Type
- T<mixed> Compatibility
- Constraints
- Open and Closed Types
- Style Guidelines
- Nullable
- Why Nullable?
- Why Not Always Use Nullable?
- Case Study
- Examples
- Various Null Handling Scenarios
- Collections
- Goals
- Vector
- Map
- Set
- Pair
- Immutable Collections
- Collection Interfaces
- Square Bracket Syntax
- Literal Syntax
- Basic PHP operators and Collections
- PHP Builtin Support
- Examples
- Limitations
- Future work on collections
- Arrays
- Shapes
- Simple Shape Example
- Shapes Across Files
- Shapes and Generics
- Summary
- Type Aliasing
- Type Aliasing
- Opaque Type Aliasing
- Opaque Type Aliases with Constraints
- Examples
- Summary
- Async
- async and await
- Type Annotating Async Functions
- Example: Coalesced Fetching
- Signature Examples
- Awaitables vs Continuations
- Continuations
- Traits
- Trait Requirements
- Trait Requirements
- Lambda Expressions
- Design
- Why ==>?
- Examples
- Tuples
- Use Cases
- Tuples Are Implemented As Arrays
- Type Annotating With Tuples
- Returning a Tuple From a Method
- Initializer Expressions
- Override Attribute
- In Traits
- Method Dispatch
- Typing XHP
- XHP Types
- XHPChild
- Returning XHP Elements
- Other XHP Information
- Future Plans
- Constructor Argument Promotion
- Other Hack Rules and Features
- Variable Number of Arguments
- Number Handling
- Type Inference
- Class Initialization
- Callbacks and fun
- Overriding on Return Type
- invariant()
- Function Signature Ordering
- Calling Non-Private Methods During Initialization
- Union Types
- Heredocs
- Nowdocs
- Casting
- Class Name Resolution
- Unsupported PHP Features in Hack
- Top-level code
- Collisions
- Parent Static Methods
- Calling Static Methods
- Predefined Interfaces and Classes
- Traversable<Tv> — The Traversable<Tv> interface
- Indexish<Tk,Tv> — The Indexish<Tk, Tv> interface
- KeyedTraversable<Tk,Tv> — The KeyedTraversable<Tk, Tv> interface
- Iterator<Tv> — The Iterator<Tv> interface
- KeyedIterator<Tk, Tv> — The KeyedIterator<Tk, Tv> interface
- IteratorAggregate<Tv> — The IteratorAggregate<Tv> interface
- Iterable<Tv> — The Iterable<Tv> interface
- KeyedIterable<Tk, Tv> — The KeyedIterable<Tk, Tv> interface
- ArrayAccess<Tk, Tv> — The ArrayAccess<Tk, Tv> interface
- Awaitable<T> — The Awaitable<T> class
- Continuation<Tv> — The Continuation<Tv> class
- XHPChild — The XHPChild interface
Hack has deep roots in PHP. In fact, most PHP files are already valid Hack files. We made a conscious choice not to support a handful of deprecated functions and features that were incompatible with static typing (e.g. “variable variables” and the extract() function). We have also added many new features that we believe will help make developers more productive.
Tuesday, March 25, 2014
Hack Language Reference
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment