One of the most frustrating parts of using Hack is accessing user-provided data through the request based
$_POST super-globals. The problem being two-fold:
- In partial mode, these aren’t typed. This means Hack assumes you know what you’re doing with the values, which can be bad.
- In strict mode, the super globals aren’t available and result in undefined variable errors in the type checker.
That’s where my new package comes in.
Hack is Facebook’s extension to PHP that makes it a much nicer language to work with. We’ve been using it at PocketRent since James discovered it and reverse-engineered how to use it from the HHVM source code. Since using it, writing vanilla PHP now feels wrong and like it’s missing this really useful, powerful features.
Facebook has just released the Hack documentation and tools that we have been using on some projects and our Hack-specific library Beatbox.