Hacklang at Slack
Hack extends the PHP language with a gradual typing system. It allows large PHP codebases to introduce powerful, flexible type assurances incrementally, one file or even one function declaration at a time. Unlike PHP 5 and 7’s long-standing typehint mechanisms, Hack checks type invariants soundly ahead of time, before running the code. Slack has recently begun migrating its large PHP codebase to Hacklang, with a goal of reducing defect density, and increasing the confidence and velocity of changes. I’ll introduce the Hack language, narrate Slack’s experience in migrating to it, and offer some lessons learned for others contemplating the switch.