r/programming • • Mar 20 '14

Facebook introduces Hack: a new programming language for HHVM

https://code.facebook.com/posts/264544830379293/hack-a-new-programming-language-for-hhvm/
802 Upvotes

526 comments sorted by

View all comments

0

u/Chandon Mar 20 '14

Why keep all the ugly from PHP?

Languages like Clojure and Elixir have demonstrated that it's possible to build a language that retains compatibility with an existing language without retaining the syntax or even many of the semantic warts of the original.

1

u/JW_00000 Mar 20 '14

Valid question. Why not just port another language or create a completely new language to HHVM? As Clojure/Java and Elixir/Erlang demonstrate, a perfect interoperability with the 'original' language is possible.

0

u/[deleted] Mar 20 '14

[deleted]

1

u/Chandon Mar 20 '14

If you have a Java project and you start adding Clojure code, the transition is basically transparent. Clojure code can call Java methods trivially, and calling Clojure functions from Java just requires a gen-class annotation to give Java a type signature for the method.

Elixer / Erlang, CoffeeScript / JavaScript, or Scala / Java are even simpler examples. The functions that you define work from the host language exactly as if they were written in that language.

The only downside is that you need to keep files in the different languages separate and pasting code between them doesn't work. But as we can see with C++ / C, preserving "paste compatibility" comes at a reasonably high cost that you're stuck with even when you've almost entirely stopped writing code in the original language.