welcome to TECHNO WORLD

Sunday 23 March 2014

A new programming Language Introduced by Facebook - { hack }



Facebook has just released [ Introduced ]  a new programming language called 'HACK', designed to build complex websites and other software quickly and without many flaws and also the main motive of decreasing resource conservation. The company has already migrated almost all of its PHP-based social networking site to HACK over the last year, but it has nothing to do with Hacking.

Facebook :- 
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.
We have deployed Hack at Facebook and it has been a great success. Over the last year, we have migrated nearly our entire PHP codebase to Hack, thanks to both organic adoption and a number of homegrown refactoring tools.
We're also proud to release an open source version of Hack to the public at http://hacklang.org/ as part of our HHVM runtime platform, which will now support both Hack and PHP.

Download Link:- http://docs.hhvm.com/manual/en/install.php 


Official site :- http://hacklang.org/



Thus, Hack was born! Facebook Team decides to develop a new programming language that could combine elements of static-type programming languages such as C or C++ with dynamic-type languages like PHP, now called "HACK Programming Language".

"Hack has deep roots in PHP. In fact, most PHP files are already valid Hack files." Facebook said, "We have also added many new features that we believe will help make developers more productive."

HACK is a new version of PHP, requires Facebook’s HHVM (Hip Hop Virtual Machine) which is designed to execute programs written in Hack and PHP. The top 20 open source frameworks on Github run on HHVM.











by Facebook's - { hack } official site  :- 
The following are some of the important language features of Hack. For more information, see the full documentation, or follow through the quick interactive tutorial.
  • Type Annotations allow for PHP code to be explicitly typed on parameters, class member variables and return values:
<?hh
class MyClass {
const int MyConst = 0;
private string $x = '';
public function increment(int $x): int {
$y = $x + 1;
return $y;
}
}
  • Generics allow classes and methods to be parameterized (i.e., a type associated when a class is instantiated or a method is called) in the same vein as statically type languages like C# and Java):
<?hh
class Box<T> {
protected T $data;
public function __construct(T $data) {
$this->data = $data;
}
public function getData(): T {
return $this->data;
}
}
  • Nullable Types are supported by Hack through use of the ? operator. This introduces a safer way to deal with nulls and is very useful for primitive types that don’t generally allow null as one of their values, such as bool and int (using ?bool and ?intrespectively). The operator can be used on any type or class.
  • Collections enhance the experience of working with PHP arrays, by providing first class, built-in parameterized types such as Vector (an ordered, index-based list), Map(an ordered dictionary), Set (a list of unique values), and Pair (an index-based collection of exactly two elements).
  • Lambdas offer similar functionality to PHP closures, but they capture variables from the enclosing function body implicitly and are less verbose:
<?hh
function foo(): (function(string): string) {
$x = 'bar';
return $y ==> $x . $y;
}
function test(): void {
$fn = foo();
echo $fn('baz'); // barbaz
}
Other significant features of Hack include ShapesType AliasingAsync support, andmuch more

Stay tuned to +Techno World  for more Technology updates  





2 comments :

  1. Sir i want to learn this language..........
    so i want d complete tutorial for this language......
    i request u to send link to this email id-rocky.dinesh31@gmail.com

    ReplyDelete
  2. yeah sure .. let me Google it ..

    ReplyDelete

Thanx for all your Feedback .... and don't post to promote your site's ...

I kept the option as Comment moderation mode. So if you try to promote your site from here.. I do delete your comment's ..