Hack and HHVM: Programming Productivity Without Breaking Things

How are you able to reap the benefits of the HipHop digital desktop (HHVM) and the Hack programming language, new applied sciences that fb constructed to run their internet servers? With this sensible consultant, Owen Yamauchi—a member of Facebook’s middle Hack and HHVM teams—shows you ways to start with those battle-tested open-source tools.

You’ll discover static typechecking and a number of other beneficial properties that separate Hack from its personal home page origins, and find out how to manage, configure, set up, and display screen HHVM. excellent for builders with simple Hypertext Preprocessor wisdom or adventure with different languages, this e-book additionally demonstrates how those instruments can be utilized with current Hypertext Preprocessor codebases and new tasks alike.

  • Learn how Hack presents static typechecking whereas maintaining PHP’s versatile, fast improvement capability
  • Write typesafe code with Hack’s generics feature
  • Explore HHVM, a just-in-time compilation runtime engine with complete personal home page compatibility
  • Dive into Hack collections, asynchronous services, and the XHP extension for PHP
  • Understand Hack’s layout reason, together with why it omits a few personal home page features
  • Use Hack for multitasking, and for producing HTML securely
  • Learn instruments for operating with Hack code, together with PHP-to-Hack migration

Show description

Preview of Hack and HHVM: Programming Productivity Without Breaking Things PDF

Best Programming books

Joe Celko's SQL for Smarties: Advanced SQL Programming Third Edition (The Morgan Kaufmann Series in Data Management Systems)

SQL for Smarties used to be hailed because the first ebook dedicated explicitly to the complex strategies had to remodel an skilled SQL programmer into a professional. Now, 10 years later and within the 3rd version, this vintage nonetheless reigns perfect because the booklet written by way of an SQL grasp that teaches destiny SQL masters.

Designing Audio Effect Plug-Ins in C++: With Digital Audio Signal Processing Theory

Not only one other theory-heavy electronic sign processing e-book, nor one other boring build-a-generic-database programming booklet, Designing Audio impression Plug-Ins in C++ provides every thing you every thing you must be aware of to do exactly that, together with absolutely labored, downloadable code for dozens audio impression plug-ins and essentially offered algorithms.

Effective C++: 55 Specific Ways to Improve Your Programs and Designs (3rd Edition)

“Every C++ specialist wishes a replica of powerful C++. it really is an absolute must-read for somebody deliberating doing severe C++ improvement. If you’ve by no means learn powerful C++ and also you imagine you recognize every little thing approximately C++, reassess. ”— Steve Schirripa, software program Engineer, Google “C++ and the C++ group have grown up within the final fifteen years, and the 3rd version of powerful C++ displays this.

Cocoa Design Patterns

“Next time a few child exhibits up at my door soliciting for a code evaluation, this is often the ebook that i'm going to throw at him. ”   –Aaron Hillegass, founding father of huge Nerd Ranch, Inc. , and writer of Cocoa Programming for Mac OS X   Unlocking the secrets and techniques of Cocoa and Its Object-Oriented Frameworks   Mac and iPhone builders are frequently crushed through the breadth and class of the Cocoa frameworks.

Extra info for Hack and HHVM: Programming Productivity Without Breaking Things

Show sample text content

That's to assert, the runtime has loads of leeway to make a decision what to do. it is just allowed to droop speak() while it encounters an look ahead to expression. inside that constraint, it might probably droop and resume speak() as again and again because it desires. this is often to provide the async scheduler the pliability to rearrange async execution because it sees healthy, however it does suggest you must be cautious to watch for any wait deal with that you simply create. Failing to watch for a wait deal with will lead to unpredictable habit. expecting a wait deal with promises that it'll run to of entirety. you could believe tempted to do whatever like this to enforce indifferent tasks—that is, if you happen to are looking to commence a role and allow it run, yet you don’t are looking to block anything on awaiting it to complete. Nonessential logging in an internet program is a standard factor that tempts humans to do that. Async doesn’t supply the way to detach projects. the one solution to strength a wait deal with to run is to anticipate it, and there’s no method to look forward to a wait deal with with out most likely blockading. whether you watch for all wait handles that you just create, it’s nonetheless attainable to determine their results in numerous orders. during this instance, any unwanted side effects (writing to the output buffer, community or disk I/O, and so on. ) of some_unrelated_stuff() might occur prior to or after any negative effects of some_async_function(): async functionality f(): Awaitable { $handle = some_async_function(); some_unrelated_stuff(); watch for $handle; } normally, setting apart the developing of wait handles from watching for them is discouraged; the construction and anticipating of a wait deal with should still take place as shut jointly as attainable. The previous instance will be greater written as: async functionality f(): Awaitable { some_unrelated_stuff(); watch for some_async_function(); } Don’t imagine, since you notice the “correct” ordering of results as soon as, that they are going to constantly occur in that order. The ordering can switch among executions of an analogous code. to prevent having to be anxious approximately this, you'll want to as a rule attempt to not write async capabilities that experience unintended effects whose order is critical. that will implement that issues occur in a selected order, you want to create a dependency among them utilizing watch for. Async Doesn’t Create Threads From the point of view of Hack code, the realm is single-threaded, similar to in Hypertext Preprocessor. An async functionality isn't a thread; a number of async services won't run in parallel. A unmarried PHP/Hack environment’s code won't run on a number of CPU cores. (HHVM does run a number of internet requests in parallel utilizing system-level threads, however the PHP/Hack environments in these threads can’t substantively engage with one another. ) The async extensions might be utilizing threads behind the curtain, yet that’s an implementation aspect, now not noticeable to Hack code. after all, there are occasions should you may still use threads for parallelism—i. e. , while you’re doing CPU-intensive paintings that may be damaged down into numerous projects that have to synchronize with one another sometimes. In these situations, async won't assist you, and actually Hack will not be the suitable language for the activity.

Download PDF sample

Rated 4.62 of 5 – based on 6 votes