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

Show parent comments

7

u/alokmenghrajani Mar 20 '14 edited Mar 20 '14

I can think of quite a few:

  • you are experimenting with an idea. You might want to tell the type checker to leave you alone while still be able to see your code run.

  • you are refactoring some large piece of code. You want to run tests or specific pieces of code to make sure you are headed in the right direction.

  • A part of your code might deal with lots of unstructured data (e.g. json) and it might be easier to write the code without boxing all the data in what boils down to untyped containers.

5

u/smog_alado Mar 20 '14

The partially-incorrect code is not necessarily an advantage of dynamic typing. Some languages, like Haskell, let you defer compile-time errors to runtime, allowing you to run partial code. Sure, dynamic languages do this "for free" but its no different from other type system features that they give "for free", like polymorphism and generics.