Skip to main content

Posts

Showing posts from May, 2014

Hack : A Look at Programming Language By Facebook

As every PHP developer should be aware of the Programming Language developed by Facebook : Hack. It is basically based on PHP, you can say PHP but a strongly / statically typed language like Java .(i.e. a language which have fixed datatype). Let me give you a simple example. In normal PHP ,we have functions like <?php function addOne($num1){      return ($num1+1) ; } ?> But in hack this code will be changed to <?hh  function addOne(int $num1) : int{      return ($num1+1); }  You must have notice the major difference. Inside function parameters, in HACK, we have mentioned int as datatype and int as return type. This is one of major difference between PHP and Hack. But this is not the only reason, Why Hack actually evolves?? Basically, We have an advantage in PHP that it need not to be compiled(unlike java), just make changes in file and reload the browser. Languages like Java are slow in sense that they first need to be compiled, then they can be run, but