Facebook Introduces Hack: Statically Typed PHP 230
alokmenghrajani (2602135) writes with news of Facebook's new Open Source language, Hack. Quoting: "Today we're releasing Hack, a programming language we developed for HHVM that interoperates seamlessly with PHP. Hack reconciles the fast development cycle of PHP with the discipline provided by static typing, while adding many features commonly found in other modern programming languages. ... Traditionally, dynamically typed languages allow for rapid development but sacrifice the ability to catch errors early and introspect code quickly, particularly on larger codebases. Conversely, statically typed languages provide more of a safety net, but often at the cost of quick iteration. We believed there had to be a sweet spot. ... Hack has deep roots in PHP. In fact, most PHP files are already valid Hack files. ... Our principal addition is static typing. We have developed a system to annotate function signatures and class members with type information; our type checking algorithm infers the rest. Type checking is incremental, such that even within a single file some code can be converted to Hack while the rest remains dynamically typed. ... If a function parameter or class member does not have an explicit type annotation, the type checker considers its type to be dynamic, and it does not check the type of that value."
In addition to static typing, they've introduced proper closures that capture the lexical environment, generics, collections, and array shapes. The Hack website has more details. There's a fairly complete language manual, tools to infer types in PHP source and annotate the code, and source available under the PHP license.
Sarcastically Typed (Score:5, Funny)
We really need a sarcastically typed language. That would be truly awesome.
Re:hate the name (Score:5, Funny)
"The answer will be something about putting together a quick Hack program to change values in a database"
I take it you don't get invited back to dinner very often.
Re:English? (Score:4, Funny)
Can someone please convert the summary in english, with basic explanations?
My interpretation of the summary is: Facebook has sunk a lot of investment into a turd, and now they've determined that that turd needs polishing.
Re:hate the name (Score:5, Funny)
Hey, three focus groups chose this over "Kludge".
Re:English? (Score:2, Funny)
So not much different than PHP then...
(ducks)
Re:English? (Score:5, Funny)
So not much different than PHP then...
(ducks)
It generates Perl?