Is the hack of Facebook a future development for PHP?

Source: Internet
Author: User
Tags hhvm php language php code zend

Why does Facebook want to build a hack?

First, Facebook's internal code is written in PHP, and Facebook allows many new developers to use PHP because language is easy to learn and use. Of course, Facebook's PHP code may be converted to C derivatives and pushed to a previous production environment. The point is that Facebook relies heavily on the PHP language to attract new talent and improve the efficiency of its developers.

Hack the strict type

Unfortunately, PHP cannot be implemented on a Facebook scale. Because PHP is a loosely typed language, many errors about the type may not be discovered at run time. That means Facebook has to write a lot of tests to perform type error checking early in the morning, or spend more time rebuilding the post-run error. To address such a problem, Facebook adds a strict type to attack the Run-time return type. Strict typing kills the need for many related unit tests, while also motivating developers to capture type-related errors during early development.

hack instantaneous type check

To make it easier to catch bugs in the development process, Facebook's HHVM engine includes a type of checking server that monitors hack code while it is running locally. The developer's code editor and IDE can use this type to check the server to report syntax or type-related errors immediately during code development.

What about the existing PHP code?

Most of the existing PHP code will run on Facebook's HHVM engine, which is necessary because Facebook's existing code base is mostly PHP code. There are some exceptions to the hack code, which are not equivalent to traditional PHP, such as some language features (such as variables) and Zend extensions are still unsupported. Over time, HHVM will also implement parity checking with the Zend engine as soon as possible.

In addition, the hack language created by Facebook is gradually migrating with traditional PHP code.

does this mean that PHP is "dead"?

If hack is so good, does this mean that PHP's days are numbered? The answer is of course: no! traditional PHP Zend is approved by a specialized organization, and any new features must be approved by the members of the organization before they can be published, when 100% is fair and open.

But hack is very good, hack has a lot of their own unique features, so can never become a traditional PHP language. Facebook's HHVM engine performs better than the Zend engine, and it has more in-house developers and is committed to constantly making the HHVM engine better.

This does not mean that PHP's Zend engine will disappear, and that the Zend and HHVM engines can and will coexist. Competition is a good thing and I hope that these two Zend and HHVM will benefit from each other's strengths.

is Facebook responsible?

Hack is a product of Facebook, mainly from Facebook engineers. While the public now wants it to be announced, hack and HHVM still rely heavily on continued investment and engagement with Facebook.

Future

Because of the superiority of hack and HHVM, I want to think, in a way, that hack is the future of PHP.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.