Specification for Hack
May 30, 2017 ยท View on GitHub
Facebook has dedicated all copyright to this specification to the public domain worldwide under the CC0 Public Domain Dedication located at http://creativecommons.org/publicdomain/zero/1.0/. This specification is distributed without any warranty.
(Initially written by Facebook, Inc., February 2015)
Table of Contents
- Introduction
- Conformance
- Terms and Definitions
- Basic Concepts
- Program Structure
- Program Start-Up
- Program Termination
- The Memory Model
- General
- Reclamation and Automatic Memory Management
- Assignment
- General
- Value Assignment of Scalar Types to a Local Variable
- Value Assignment of Object and Resource Types to a Local Variable
- ByRef Assignment for Scalar Types with Local Variables
- Byref Assignment of Non-Scalar Types with Local Variables
- Value Assignment of Array Types to Local Variables
- Deferred Array Copying
- General Value Assignment
- General ByRef Assignment
- Argument Passing
- Value Returning
- Cloning objects
- Scope
- Storage Duration
- Types
- General
- The Boolean Type
- The Integer Type
- The Floating-Point Type
- The Numeric Type
- The String Type
- The Array Key Type
- The Null Type
- Enumerated Types
- The Void Type
- Array Types
- Class Types
- Interface Types
- Trait Types
- The
thisType - Tuple Types
- Shape Types
- Closure Types
- Resource Types
- Nullable Types
- Generic Types
- The Classname Type
- Type Aliases
- Supertypes and Subtypes
- Type Side Effects
- Type Inferencing
- Constants
- Variables
- Conversions
- General
- Converting to Boolean Type
- Converting to Integer Type
- Converting to Floating-Point Type
- Converting to Number Type
- Converting to String Type
- Converting to Array Key Type
- Converting to Array Type
- Converting to Object Type
- Converting to Interface Type
- Converting to Resource Type
- Converting to Mixed Type
- Lexical Structure
- Expressions
- General
- Restrictions on Arithmetic Operations
- Operations on Operands Having One or More Subtypes
- Primary Expressions
- Postfix Operators
- Unary Operators
instanceofOperator- Multiplicative Operators
- Additive Operators
- Bitwise Shift Operators
- Relational Operators
- Equality Operators
- Bitwise AND Operator
- Bitwise Exclusive OR Operator
- Bitwise Inclusive OR Operator
- Logical AND Operator
- Logical Inclusive OR Operator
- Conditional Operator
- Coalesce Operator
- Pipe Operator
- Lambda Expressions
- Assignment Operators
yieldOperator- Constant Expressions
- Statements
- Script Inclusion Operators
- Enums
- Generic Types, Methods, and Functions
- Functions
- Classes
- Interfaces
- General
- Interface Declarations
- Interface Members
- Constants
- Methods
- Predefined Interfaces
- Interface
ArrayAccess - Interface
AsyncIterator - Interface
AsyncKeyedIterator - Interface
Awaitable - Interface
Container - Interface
IMemoizeParam - Interface
Iterator - Interface
IteratorAggregate - Interface
KeyedContainer - Interface
KeyedTraversable - Interface
Serializable - Interface
Stringish - Interface
Traversable
- Interface
- Traits
- Exception Handling
- Namespaces
- Attributes
- Grammar
- General
- Lexical Grammar
- Syntactic Grammar
- Program Structure
- Types
- Variables
- Expressions
- Primary Expressions
- Postfix Operators
- Unary Operators
- instanceof Operator
- Multiplicative Operators
- Additive Operators
- Bitwise Shift Operators
- Relational Operators
- Equality Operators
- Bitwise Logical Operators
- Logical Operators
- Conditional Operator
- Pipe Operator
- Lambda Expressions
- Assignment Operators
- yield Operator
- Constant Expressions
- Statements
- Script Inclusion
- Enums
- Generic Types, Methods and Functions
- Functions
- Classes
- Interfaces
- Traits
- Namespaces
- Attributes
- Differences from PHP
- General
- Program Start-Up
- Constants
- Variables
- Conversions
- Lexical Structure
- Expressions
- Statements
- Script Inclusion
- Functions
- Classes
- Interfaces
- Traits
- Namespaces
- Bibliography