Hack And Hhvm_ Programming Productivity Without Breaking Things.pdf
(
3243 KB
)
Pobierz
Hack &
HHVM
PROGRAMMING PRODUCTIVITY WITHOUT BREAKING THINGS
Owen Yamauchi
www.allitebooks.com
Hack and HHVM
How can you take advantage of the HipHop Virtual Machine (HHVM) and
the Hack programming language, two new technologies that Facebook
developed to run their web servers? With this practical guide, Owen
Yamauchi—a member of Facebook’s core Hack and HHVM teams—shows
you how to get started with these battle-tested open source tools.
You’ll explore static typechecking and several other features that separate
Hack from its PHP origins, and learn how to set up, configure, deploy,
and monitor HHVM. Ideal for developers with basic PHP knowledge or
experience with other languages, this book also demonstrates how these
tools can be used with existing PHP codebases and new projects alike.
■
Hack is remarkable not
“
only for the elegance and
power of its type system
and concurrency model,
but because it provides
existing PHP applications
a thoughtful, iterative
migration strategy that
can be executed at
scale. Yamauchi's survey
of the language and its
runtime is clear, expert,
and essential. Highly
recommended.
Learn how Hack provides static typechecking while retaining
PHP’s flexible, rapid development capability
Write typesafe code with Hack’s generics feature
Explore HHVM, a just-in-time compilation runtime engine with
full PHP compatibility
Dive into Hack collections, asynchronous functions, and the
XHP extension for PHP
Understand Hack’s design rationale, including why it omits
some PHP features
Use Hack for multitasking, and for generating HTML securely
Learn tools for working with Hack code, including PHP-to-Hack
migration
■
■
■
”
■
Principal Performance Engineer,
Wikimedia Foundation
—Ori Livneh
■
■
Owen Yamauchi
is a software engineer at Facebook, where he works on the
Hack and HHVM teams. Before joining the company in 2009, he worked as a
software engineer at Apple and served as an intern at VMware.
PHP
Twitter: @oreillymedia
facebook.com/oreilly
CAN $40.99
US $34.99
ISBN: 978-1-491-92087-9
www.allitebooks.com
Programming Productivity
Without Breaking Things
Hack and HHVM
Owen Yamauchi
Boston
www.allitebooks.com
Hack and HHVM
by Owen Yamauchi
Copyright © 2015 Facebook, Inc. All rights reserved.
Printed in the United States of America.
Published by O’Reilly Media, Inc., 1005 Gravenstein Highway North, Sebastopol, CA 95472.
O’Reilly books may be purchased for educational, business, or sales promotional use. Online editions are
also available for most titles (http://safaribooksonline.com). For more information, contact our corporate/
institutional sales department: 800-998-9938 or
corporate@oreilly.com.
Editor:
Allyson MacDonald
Production Editor:
Melanie Yarbrough
Copyeditor:
Rachel Head
Proofreader:
Jasmine Kwityn
September 2015:
First Edition
Indexer:
Ellen Troutman-Zaig
Interior Designer:
David Futato
Cover Designer:
Ellie Volkhausen
Illustrator:
Rebecca Demarest
Revision History for the First Edition
2015-09-02:
First Release
See
http://oreilly.com/catalog/errata.csp?isbn=9781491920879
for release details.
The O’Reilly logo is a registered trademark of O’Reilly Media, Inc.
Hack and HHVM,
the cover image,
and related trade dress are trademarks of O’Reilly Media, Inc.
While the publisher and the author have used good faith efforts to ensure that the information and
instructions contained in this work are accurate, the publisher and the author disclaim all responsibility
for errors or omissions, including without limitation responsibility for damages resulting from the use of
or reliance on this work. Use of the information and instructions contained in this work is at your own
risk. If any code samples or other technology this work contains or describes is subject to open source
licenses or the intellectual property rights of others, it is your responsibility to ensure that your use
thereof complies with such licenses and/or rights.
978-1-491-92087-9
[LSI]
www.allitebooks.com
Table of Contents
Foreword. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ix
Preface. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xi
1. Typechecking. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
Why Use the Typechecker?
Setting Up the Typechecker
Autoload Everything
Reading Error Messages
Type Annotation Syntax
Function Return Types
Function Parameters
Properties
Hack’s Type System
Typechecker Modes
Code Without Annotations
Calling into PHP
Rules
Using Superglobals
Types of Overriding Methods
Property Initialization
Typed Variadic Arguments
Types for Generators
Fallthrough in switch Statements
Type Inference
Variables Don’t Have Types
Unresolved Types
Inference Is Function-Local
1
2
3
3
4
4
5
6
6
14
16
17
18
18
19
20
23
24
25
26
26
26
28
iii
www.allitebooks.com
Plik z chomika:
jacek_040
Inne pliki z tego folderu:
Exploiting Web-Based Applications - FREE Video Training Course PART 1.rar
(506812 KB)
Exploiting Web-Based Applications - FREE Video Training Course PART 2.rar
(933817 KB)
50 Android Hacks.pdf
(3465 KB)
50 Reasons For Mastering Penetration Testing.azw3
(171 KB)
610.1 - Malware Analysis Fundamentals.pdf
(31650 KB)
Inne foldery tego chomika:
Zgłoś jeśli
naruszono regulamin