Upload
kyle-ferguson
View
992
Download
2
Embed Size (px)
DESCRIPTION
What is Hack, why should you care, and how to get started.
Hack
- Programming language for HHVM
- Evolved from PHP
Benefits
- Created by Facebook, open source
- If you know PHP, you know Hack
- Easy to adopt (even w/ existing code base)
- Language additions (generics, collections, etc.)
PHP (dynamic)
- Rapid development cycle
- Easily deployed
- Highly available
Java/C++ (static)
- Disciplined
- Scales better
Goals for Hack
Introducing Hack
What gets “typed”
Members
Parameters
Returns
Types
Primitive: string, int, bool, array
Nullable: ?string, ?FooInterface
Classes: Validator, FooInterface
Other: mixed, void, this
Also see: closures, collections, generics, constraints
Tuples: (string, int)
Modes
Partial (default)!!- Nothing is *required* to have types defined - Allows for incremental adoption
Strict!!- EVERYTHING must be typed
Decl!!- Allows “Strict” code to work with legacy code - Always avoid this mode if possible
Unpredictable code is DANGEROUSHack provides a *more* predictable PHP
Migrating
Migrating
Migrating
Migrating
Migrating
Migrating
Tools / Help
Documentation docs.hhvm.com
Editor plugins: Vim, Emacs
Example Site: github.com/hhvm/hack-example-site
Dev Environment: github.com/senary/harbor