Skip to content

Hack is a programming language for HHVM, developed by Meta, combining static and dynamic typing. It enhances performance, ensures type safety, and supports PHP compatibility for modern web development.

Notifications You must be signed in to change notification settings

mgunawardhana/learning-hack-pr-lang-basics

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 

Repository files navigation

Meta Logo

Hack Programming Language

Hack is a type-safe programming language developed and open-sourced by Meta (formerly Facebook). It’s designed to improve developer productivity, combining the speed and flexibility of PHP with modern programming features like static type checking. Hack runs on the HHVM (HipHop Virtual Machine), ensuring excellent performance and scalability.


🚀 Why Hack?

Hack introduces a gradual typing system, empowering developers to:

  • Catch bugs early with static type-checking.
  • Refactor code safely while maintaining flexibility.
  • Leverage modern features like async programming, collections, and generics.

Hack allows you to incrementally add types to an existing PHP codebase, making it ideal for large-scale applications.


🌟 Key Features

  1. Gradual Typing
    Migrate seamlessly from dynamic to static typing. Add types where needed.

  2. Advanced Type System
    Supports generics, nullable types, and collections to write safer, clearer code.

  3. Asynchronous Programming
    Use async and await for non-blocking code execution, ideal for I/O-bound tasks.

  4. High Performance
    Powered by HHVM, Hack achieves fast execution speeds for web-scale applications.

  5. Codebase Compatibility
    Designed for easy interoperability with existing PHP codebases.


🛠️ Getting Started

Prerequisites

  • HHVM (HipHop Virtual Machine) is required to run Hack.
    Install HHVM from https://hhvm.com/.

Install HHVM

# On Debian/Ubuntu
sudo apt-get install hhvm

Create Your First Hack File

Create a file named hello.hack:

<?hh

<<__EntryPoint>>
function main(): void {
  echo "Hello, Hack!\n";
}

Run the script:

hhvm hello.hack

📚 Documentation

Explore the official documentation to learn more about Hack:


🌐 Who Uses Hack?

Hack is extensively used within Meta (Facebook) to power mission-critical applications. It has proven its capabilities in handling billions of requests daily at a global scale.


🤝 Contributing

Hack is open-source and welcomes contributions from the community. Get involved by visiting the repository:
GitHub: https://github.com/facebook/hhvm

About

Hack is a programming language for HHVM, developed by Meta, combining static and dynamic typing. It enhances performance, ensures type safety, and supports PHP compatibility for modern web development.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages