r/programming • u/[deleted] • 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
r/programming • u/[deleted] • Mar 20 '14
5
u/pipocaQuemada Mar 20 '14
What languages other than C# use ':' for inheritance? Also, ':' or '::' has been used in dozens of languages for type ascription dating back to the 70's. It's not a new syntactic invention by any means. Check out e.g. SML, OCaml, Haskell, Scala, F#, Clean, Miranda, etc.
I assume you mean the snippet
I don't really know Hack, but it looks like it's the equivalent of the C#
That is to say, you neither need to specif a method name nor a method signature, and ==> is the actual syntax for the lambda. It's not really that strange, especially because a number of languages use => for lambdas. Since it's a first class value, you can return it from a method, and if you want to give it a type, the type is "function(string): string".