SlideShare a Scribd company logo
1 of 66
Programming in Hack
Alejandro Marcu
Dutch PHP Conference 2016
2
 Started programming Logo at
8 years old
 Then moved to Basic, Turbo
Pascal, C++, Java
 2001 – 2004 Various
programming jobs in
Argentina
 2004 – 2008: TopCoder
 2009 – 2015: Facebook
Alejandro Marcu
3
1. Introduction
2. Hack Types
3. Collections
4. Async
5. XHP
6. Hack Codegen
What You Will Learn Today
Introduction
5
HHVM history
 2007 - Hackathon project: convert PHP to c++
 2009 – HipHop (HPHPc) in prod in Facebook
 2010 – Open sourced HipHop for PHP
 2010 – Started the HHVM project
 2013 – HHVM in prod in Facebook
 2013 – HHVM open sourced
6
 In 2014 Wikipedia migrated to HHVM:
 CPU load went from 50% to 10%
 Mean page save time went 6s to 3s
 Average page load time went from 1.3s to 0.9s
 PHP 7 performance is close to HHVM
Example of migration to HHVM
7
 Started in 2012 as “strict-mode” project
 Grew to be much more than that
 Open sourced in 2014
 As of now, HHVM is the only execution engine that
runs Hack
 Totally interoperable with PHP, allowing for a gradual
migration
Hack
8
 Analyzes Hack programs statically
 Monitors files changes in the background
 Extremely fast, even in huge code bases
 Can even be used by IDEs to autocomplete code
Typechecker
Typechecker
hacklang.org/tutorial/
10
 Type annotations
 Collections
 Async
 XHP
 Attributes
 Constructor parameter
Promotion
 Enums
 Generics
Hack only features
 Operators
 Lambda
 Null safe
 XHP attribute access
 Pipe operator
 Shapes
 Trait and interfaces
requirements
 Type aliases
11
 References
 Global statements
 Top level code
 Variable variables
 Dynamic properties
 Pseudo-functions
 isset
 empty
 Unset
 goto
 Etc..
Unsupported features in Hack
12
<?hh //strict  Type annotations required
 Can’t call PHP
 No top level code
 No references
<?hh // partial
or
<?hh
 The following is allowed but not checked:
• Calls to PHP
• Top level code
• References
 Type annotations not required but checked
if present
<?hh // decl  Not checked at all
 Functions and classes are indexed
 Use it only as the first step to migrate to
Hack
Typechecker modes
Type annotations
14
Types
 Primitive types
 bool
 int
 float
 string
 array
 resource
 Combined primitive types
 num (int or float)
 arraykey (int or string)
 Object types
 Name of classes or interfaces
Return types
void can be used only as a return type
Parameters
Nullable parameters
Local variables
Class attributes
Class attributes
Class attributes
Constructor argument promotion
Enums
Enums
Enums
Generics
Arrays with generics
Collections
Vector
0-indexed list
Map
Keys: int or str.
Values: anything
Set
Unique elements
Collections overview
Vector
Map
Set
Immutability
Immutability
Immutability
Async
37
 Single thread blocking
 Single thread non-blocking
 Multithread
Threads
Single Thread blocking example
Single Thread blocking example
Single Thread blocking example
Async example
Async example
Async example
44
 Use the keyword async before function
 The return type must be Awaitable<…>
 Call async from async using await
 Call async from non-async using HHAsiojoin
 Make parallel calls using helpers in HHAsio
(such as v,vm,m,mf, etc.)
Async
XHP
46
What is XHP?
 XHP is used to generate HTML in PHP or Hack
 No templating
 No string concatenating
 Represent HTML as a tree of objects
 Familiar XML syntax
 Secure
 Strong validations
 Extensible
Hello World
composer.json
xhp.php
Hello World
Adding children
Custom class definition
Inheriting and transferring attributes
Async components
53
XHP parser transforms it into regular Hack code:
 XHP class names are replaced:
 First char colon is replaced with xhp_
 Other colons are replaced with two underscores
 Hyphens are replaced with an underscore
 E.g. :ui:nav:header is replaced with
xhp_ui__nav__header
XHP internals
54
 XHP tags are replaced with constructors. E.g.
will be replaced with:
XHP internals
Hack Codegen
56
Why code generation?
 Code generation: writing code that writes code
 Higher level of abstraction
 Generate boilerplate code
 Generate code from almost static data in database
 Replace usage of __call
57
 Easy to create files, functions, classes, methods,
arrays, collections, etc
 Support for partially generated files
 Files can be signed
 No string concatenation
 No need to indent or add spaces
 https://github.com/facebook/hack-codegen/
 Composer: require facebook/hack-codegen
Hack Codegen
Hack Codegen example
Hack Codegen example output
ORM code generation
ORM code generation
ORM code generation
ORM code generation
Learning Resources
65
Learning resources
 http://hacklang.org/ : installation, tutorial, docs
 “Hack & HHVM” book
Contact Information
amarcu@gmail.com
/alejandro.marcu
/alejandromarcu
@AlejandroMarcu
/in/alejandromarcu

More Related Content

What's hot

Chap1introppt1php basic
Chap1introppt1php basicChap1introppt1php basic
Chap1introppt1php basicmonikadeshmane
 
Advanced c programming in Linux
Advanced c programming in Linux Advanced c programming in Linux
Advanced c programming in Linux Mohammad Golyani
 
A la découverte de TypeScript
A la découverte de TypeScriptA la découverte de TypeScript
A la découverte de TypeScriptDenis Voituron
 
Golang 101
Golang 101Golang 101
Golang 101宇 傅
 
Functional programming with Java 8
Functional programming with Java 8Functional programming with Java 8
Functional programming with Java 8Talha Ocakçı
 
Rest style web services (google protocol buffers) prasad nirantar
Rest style web services (google protocol buffers)   prasad nirantarRest style web services (google protocol buffers)   prasad nirantar
Rest style web services (google protocol buffers) prasad nirantarIndicThreads
 
Difference between Java and c#
Difference between Java and c#Difference between Java and c#
Difference between Java and c#Sagar Pednekar
 
Compilation and Execution
Compilation and ExecutionCompilation and Execution
Compilation and ExecutionChong-Kuan Chen
 
Experience protocol buffer on android
Experience protocol buffer on androidExperience protocol buffer on android
Experience protocol buffer on androidRichard Chang
 
Visual Studio .NET2010
Visual Studio .NET2010Visual Studio .NET2010
Visual Studio .NET2010Satish Verma
 
Using ANTLR on real example - convert "string combined" queries into paramete...
Using ANTLR on real example - convert "string combined" queries into paramete...Using ANTLR on real example - convert "string combined" queries into paramete...
Using ANTLR on real example - convert "string combined" queries into paramete...Alexey Diyan
 
.Net passé, présent et futur
.Net passé, présent et futur.Net passé, présent et futur
.Net passé, présent et futurDenis Voituron
 

What's hot (20)

C# and vb
C# and vbC# and vb
C# and vb
 
Lex
LexLex
Lex
 
Chap1introppt1php basic
Chap1introppt1php basicChap1introppt1php basic
Chap1introppt1php basic
 
C-Sharp 6.0 ver2
C-Sharp 6.0 ver2C-Sharp 6.0 ver2
C-Sharp 6.0 ver2
 
Advanced c programming in Linux
Advanced c programming in Linux Advanced c programming in Linux
Advanced c programming in Linux
 
A la découverte de TypeScript
A la découverte de TypeScriptA la découverte de TypeScript
A la découverte de TypeScript
 
C#unit4
C#unit4C#unit4
C#unit4
 
Golang 101
Golang 101Golang 101
Golang 101
 
Functional programming with Java 8
Functional programming with Java 8Functional programming with Java 8
Functional programming with Java 8
 
Rest style web services (google protocol buffers) prasad nirantar
Rest style web services (google protocol buffers)   prasad nirantarRest style web services (google protocol buffers)   prasad nirantar
Rest style web services (google protocol buffers) prasad nirantar
 
Difference between Java and c#
Difference between Java and c#Difference between Java and c#
Difference between Java and c#
 
C# - Part 1
C# - Part 1C# - Part 1
C# - Part 1
 
Python Intro
Python IntroPython Intro
Python Intro
 
Compilation and Execution
Compilation and ExecutionCompilation and Execution
Compilation and Execution
 
Experience protocol buffer on android
Experience protocol buffer on androidExperience protocol buffer on android
Experience protocol buffer on android
 
ANTLR4 in depth
ANTLR4 in depthANTLR4 in depth
ANTLR4 in depth
 
50 shades of PHP
50 shades of PHP50 shades of PHP
50 shades of PHP
 
Visual Studio .NET2010
Visual Studio .NET2010Visual Studio .NET2010
Visual Studio .NET2010
 
Using ANTLR on real example - convert "string combined" queries into paramete...
Using ANTLR on real example - convert "string combined" queries into paramete...Using ANTLR on real example - convert "string combined" queries into paramete...
Using ANTLR on real example - convert "string combined" queries into paramete...
 
.Net passé, présent et futur
.Net passé, présent et futur.Net passé, présent et futur
.Net passé, présent et futur
 

Viewers also liked

Hacking Your Way To Better Security - Dutch PHP Conference 2016
Hacking Your Way To Better Security - Dutch PHP Conference 2016Hacking Your Way To Better Security - Dutch PHP Conference 2016
Hacking Your Way To Better Security - Dutch PHP Conference 2016Colin O'Dell
 
Magento done right - PHP UK 2016
Magento done right  - PHP UK 2016Magento done right  - PHP UK 2016
Magento done right - PHP UK 2016Ciaran Rooney
 
Security Theatre - PHP UK Conference
Security Theatre - PHP UK ConferenceSecurity Theatre - PHP UK Conference
Security Theatre - PHP UK Conferencexsist10
 
Debugging Effectively
Debugging EffectivelyDebugging Effectively
Debugging EffectivelyColin O'Dell
 
From Doctor to Coder: A Whole New World?
From Doctor to Coder: A Whole New World?From Doctor to Coder: A Whole New World?
From Doctor to Coder: A Whole New World?Aisha Sie
 
Deploy to azure in less then 15 minutes
Deploy to azure in less then 15 minutesDeploy to azure in less then 15 minutes
Deploy to azure in less then 15 minutesMichelangelo van Dam
 
Crafting beautiful software
Crafting beautiful softwareCrafting beautiful software
Crafting beautiful softwareJorn Oomen
 
DPC 2016 - 53 Minutes or Less - Architecting For Failure
DPC 2016 - 53 Minutes or Less - Architecting For FailureDPC 2016 - 53 Minutes or Less - Architecting For Failure
DPC 2016 - 53 Minutes or Less - Architecting For Failurebenwaine
 
Solving Cross-Cutting Concerns in PHP - DutchPHP Conference 2016
Solving Cross-Cutting Concerns in PHP - DutchPHP Conference 2016 Solving Cross-Cutting Concerns in PHP - DutchPHP Conference 2016
Solving Cross-Cutting Concerns in PHP - DutchPHP Conference 2016 Alexander Lisachenko
 
Feature Flags Are Flawed: Let's Make Them Better - DPC
Feature Flags Are Flawed: Let's Make Them Better - DPCFeature Flags Are Flawed: Let's Make Them Better - DPC
Feature Flags Are Flawed: Let's Make Them Better - DPCStephen Young
 
The treacherous road to microservices
The treacherous road to microservicesThe treacherous road to microservices
The treacherous road to microservicesgoatcode
 
Driving Design through Examples
Driving Design through ExamplesDriving Design through Examples
Driving Design through ExamplesCiaranMcNulty
 
Introducing Eager Design
Introducing Eager DesignIntroducing Eager Design
Introducing Eager DesignMarcello Duarte
 
Elasticsearch, the story so far
Elasticsearch, the story so farElasticsearch, the story so far
Elasticsearch, the story so farJordy Moos
 
Being functional in PHP (DPC 2016)
Being functional in PHP (DPC 2016)Being functional in PHP (DPC 2016)
Being functional in PHP (DPC 2016)David de Boer
 
Integrating Bounded Contexts Tips - Dutch PHP 2016
Integrating Bounded Contexts Tips - Dutch PHP 2016Integrating Bounded Contexts Tips - Dutch PHP 2016
Integrating Bounded Contexts Tips - Dutch PHP 2016Carlos Buenosvinos
 
The Road To Technical Team Lead
The Road To Technical Team LeadThe Road To Technical Team Lead
The Road To Technical Team Leadbenwaine
 

Viewers also liked (20)

Hacking Your Way To Better Security - Dutch PHP Conference 2016
Hacking Your Way To Better Security - Dutch PHP Conference 2016Hacking Your Way To Better Security - Dutch PHP Conference 2016
Hacking Your Way To Better Security - Dutch PHP Conference 2016
 
Magento done right - PHP UK 2016
Magento done right  - PHP UK 2016Magento done right  - PHP UK 2016
Magento done right - PHP UK 2016
 
Security Theatre - PHP UK Conference
Security Theatre - PHP UK ConferenceSecurity Theatre - PHP UK Conference
Security Theatre - PHP UK Conference
 
Debugging Effectively
Debugging EffectivelyDebugging Effectively
Debugging Effectively
 
From Doctor to Coder: A Whole New World?
From Doctor to Coder: A Whole New World?From Doctor to Coder: A Whole New World?
From Doctor to Coder: A Whole New World?
 
Deploy to azure in less then 15 minutes
Deploy to azure in less then 15 minutesDeploy to azure in less then 15 minutes
Deploy to azure in less then 15 minutes
 
Crafting beautiful software
Crafting beautiful softwareCrafting beautiful software
Crafting beautiful software
 
Scaling your website
Scaling your websiteScaling your website
Scaling your website
 
DPC 2016 - 53 Minutes or Less - Architecting For Failure
DPC 2016 - 53 Minutes or Less - Architecting For FailureDPC 2016 - 53 Minutes or Less - Architecting For Failure
DPC 2016 - 53 Minutes or Less - Architecting For Failure
 
Solving Cross-Cutting Concerns in PHP - DutchPHP Conference 2016
Solving Cross-Cutting Concerns in PHP - DutchPHP Conference 2016 Solving Cross-Cutting Concerns in PHP - DutchPHP Conference 2016
Solving Cross-Cutting Concerns in PHP - DutchPHP Conference 2016
 
Feature Flags Are Flawed: Let's Make Them Better - DPC
Feature Flags Are Flawed: Let's Make Them Better - DPCFeature Flags Are Flawed: Let's Make Them Better - DPC
Feature Flags Are Flawed: Let's Make Them Better - DPC
 
The treacherous road to microservices
The treacherous road to microservicesThe treacherous road to microservices
The treacherous road to microservices
 
Driving Design through Examples
Driving Design through ExamplesDriving Design through Examples
Driving Design through Examples
 
Introducing Eager Design
Introducing Eager DesignIntroducing Eager Design
Introducing Eager Design
 
Elasticsearch, the story so far
Elasticsearch, the story so farElasticsearch, the story so far
Elasticsearch, the story so far
 
Being functional in PHP (DPC 2016)
Being functional in PHP (DPC 2016)Being functional in PHP (DPC 2016)
Being functional in PHP (DPC 2016)
 
Integrating Bounded Contexts Tips - Dutch PHP 2016
Integrating Bounded Contexts Tips - Dutch PHP 2016Integrating Bounded Contexts Tips - Dutch PHP 2016
Integrating Bounded Contexts Tips - Dutch PHP 2016
 
OOP: Princípios e Padroes
OOP: Princípios e PadroesOOP: Princípios e Padroes
OOP: Princípios e Padroes
 
Como programar melhor jogando game boy
Como programar melhor jogando game boyComo programar melhor jogando game boy
Como programar melhor jogando game boy
 
The Road To Technical Team Lead
The Road To Technical Team LeadThe Road To Technical Team Lead
The Road To Technical Team Lead
 

Similar to Programming in hack (20)

Introduction to PHP - Basics of PHP
Introduction to PHP - Basics of PHPIntroduction to PHP - Basics of PHP
Introduction to PHP - Basics of PHP
 
Basic of PHP
Basic of PHPBasic of PHP
Basic of PHP
 
Hack and HHVM
Hack and HHVMHack and HHVM
Hack and HHVM
 
PHP
 PHP PHP
PHP
 
PHP Comprehensive Overview
PHP Comprehensive OverviewPHP Comprehensive Overview
PHP Comprehensive Overview
 
chapter 5 Server-Side Scripting (PHP).pdf
chapter 5 Server-Side Scripting (PHP).pdfchapter 5 Server-Side Scripting (PHP).pdf
chapter 5 Server-Side Scripting (PHP).pdf
 
Php introduction
Php introductionPhp introduction
Php introduction
 
Chap 4 PHP.pdf
Chap 4 PHP.pdfChap 4 PHP.pdf
Chap 4 PHP.pdf
 
Materi Dasar PHP
Materi Dasar PHPMateri Dasar PHP
Materi Dasar PHP
 
Day1
Day1Day1
Day1
 
Introduction to PHP.ppt
Introduction to PHP.pptIntroduction to PHP.ppt
Introduction to PHP.ppt
 
Php Tutorial
Php TutorialPhp Tutorial
Php Tutorial
 
PHP - Introduction to PHP Fundamentals
PHP -  Introduction to PHP FundamentalsPHP -  Introduction to PHP Fundamentals
PHP - Introduction to PHP Fundamentals
 
Basic php
Basic phpBasic php
Basic php
 
Basics PHP
Basics PHPBasics PHP
Basics PHP
 
1336333055 php tutorial_from_beginner_to_master
1336333055 php tutorial_from_beginner_to_master1336333055 php tutorial_from_beginner_to_master
1336333055 php tutorial_from_beginner_to_master
 
PHP
PHPPHP
PHP
 
Hack language
Hack languageHack language
Hack language
 
Php Unit 1
Php Unit 1Php Unit 1
Php Unit 1
 
Php manish
Php manishPhp manish
Php manish
 

Recently uploaded

UI5ers live - Custom Controls wrapping 3rd-party libs.pptx
UI5ers live - Custom Controls wrapping 3rd-party libs.pptxUI5ers live - Custom Controls wrapping 3rd-party libs.pptx
UI5ers live - Custom Controls wrapping 3rd-party libs.pptxAndreas Kunz
 
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...Matt Ray
 
Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024Andreas Granig
 
How to submit a standout Adobe Champion Application
How to submit a standout Adobe Champion ApplicationHow to submit a standout Adobe Champion Application
How to submit a standout Adobe Champion ApplicationBradBedford3
 
Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...
Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...
Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...OnePlan Solutions
 
Unveiling the Future: Sylius 2.0 New Features
Unveiling the Future: Sylius 2.0 New FeaturesUnveiling the Future: Sylius 2.0 New Features
Unveiling the Future: Sylius 2.0 New FeaturesŁukasz Chruściel
 
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdfGOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdfAlina Yurenko
 
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte GermanySuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte GermanyChristoph Pohl
 
Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...
Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...
Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...Angel Borroy López
 
SpotFlow: Tracking Method Calls and States at Runtime
SpotFlow: Tracking Method Calls and States at RuntimeSpotFlow: Tracking Method Calls and States at Runtime
SpotFlow: Tracking Method Calls and States at Runtimeandrehoraa
 
Xen Safety Embedded OSS Summit April 2024 v4.pdf
Xen Safety Embedded OSS Summit April 2024 v4.pdfXen Safety Embedded OSS Summit April 2024 v4.pdf
Xen Safety Embedded OSS Summit April 2024 v4.pdfStefano Stabellini
 
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)jennyeacort
 
Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...
Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...
Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...confluent
 
React Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief UtamaReact Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief UtamaHanief Utama
 
VK Business Profile - provides IT solutions and Web Development
VK Business Profile - provides IT solutions and Web DevelopmentVK Business Profile - provides IT solutions and Web Development
VK Business Profile - provides IT solutions and Web Developmentvyaparkranti
 
Folding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a seriesFolding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a seriesPhilip Schwarz
 
Intelligent Home Wi-Fi Solutions | ThinkPalm
Intelligent Home Wi-Fi Solutions | ThinkPalmIntelligent Home Wi-Fi Solutions | ThinkPalm
Intelligent Home Wi-Fi Solutions | ThinkPalmSujith Sukumaran
 
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024StefanoLambiase
 
Odoo 14 - eLearning Module In Odoo 14 Enterprise
Odoo 14 - eLearning Module In Odoo 14 EnterpriseOdoo 14 - eLearning Module In Odoo 14 Enterprise
Odoo 14 - eLearning Module In Odoo 14 Enterprisepreethippts
 

Recently uploaded (20)

UI5ers live - Custom Controls wrapping 3rd-party libs.pptx
UI5ers live - Custom Controls wrapping 3rd-party libs.pptxUI5ers live - Custom Controls wrapping 3rd-party libs.pptx
UI5ers live - Custom Controls wrapping 3rd-party libs.pptx
 
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...
 
Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024
 
How to submit a standout Adobe Champion Application
How to submit a standout Adobe Champion ApplicationHow to submit a standout Adobe Champion Application
How to submit a standout Adobe Champion Application
 
Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...
Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...
Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...
 
Unveiling the Future: Sylius 2.0 New Features
Unveiling the Future: Sylius 2.0 New FeaturesUnveiling the Future: Sylius 2.0 New Features
Unveiling the Future: Sylius 2.0 New Features
 
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdfGOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
 
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte GermanySuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
 
Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...
Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...
Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...
 
SpotFlow: Tracking Method Calls and States at Runtime
SpotFlow: Tracking Method Calls and States at RuntimeSpotFlow: Tracking Method Calls and States at Runtime
SpotFlow: Tracking Method Calls and States at Runtime
 
Xen Safety Embedded OSS Summit April 2024 v4.pdf
Xen Safety Embedded OSS Summit April 2024 v4.pdfXen Safety Embedded OSS Summit April 2024 v4.pdf
Xen Safety Embedded OSS Summit April 2024 v4.pdf
 
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)
 
Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...
Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...
Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...
 
React Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief UtamaReact Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief Utama
 
VK Business Profile - provides IT solutions and Web Development
VK Business Profile - provides IT solutions and Web DevelopmentVK Business Profile - provides IT solutions and Web Development
VK Business Profile - provides IT solutions and Web Development
 
Folding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a seriesFolding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a series
 
Intelligent Home Wi-Fi Solutions | ThinkPalm
Intelligent Home Wi-Fi Solutions | ThinkPalmIntelligent Home Wi-Fi Solutions | ThinkPalm
Intelligent Home Wi-Fi Solutions | ThinkPalm
 
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
 
Odoo 14 - eLearning Module In Odoo 14 Enterprise
Odoo 14 - eLearning Module In Odoo 14 EnterpriseOdoo 14 - eLearning Module In Odoo 14 Enterprise
Odoo 14 - eLearning Module In Odoo 14 Enterprise
 
Hot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort Service
Hot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort ServiceHot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort Service
Hot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort Service
 

Programming in hack

Editor's Notes

  1. class Demo { public function bar(array $a): int { return $a[0]; } }
  2. echo <div>Hello World!!</div>;
  3. function render(string $name): XHPRoot { return <div>Hello World, {$name}!!</div>; } echo render('PHP Conference');
  4. $select = <select />; $options = Vector {'yes', 'no'}; foreach ($options as $value) { $select->appendChild(<option value={$value}>{$value}</option>); }
  5. class :year-picker extends :x:element { attribute int from @required; attribute int to @required; public function render(): XHPRoot { $select = <select />; for ($i = $this->:from; $i <= $this->:to; $i++) { $select->appendChild( <option value={(string) $i}>{$i}</option> ); } return $select; } } echo <year-picker from={1960} to={1990} />;
  6. class :year-picker extends :x:element { attribute :select; use XHPHelpers; attribute int from @required; attribute int to @required; public function render(): XHPRoot { $select = <select />; for ($i = $this->:from; $i <= $this->:to; $i++) { $select->appendChild( <option value={(string) $i}>{$i}</option> ); } return $select; } } echo <year-picker from={1960} to={1990} name="selector" class="mystyle" />;
  7. class :user:link extends :x:element { attribute int userid @required; use XHPAsync; protected async function asyncRender(): Awaitable<XHPRoot> { $user = await get_user_data($this->:userid); return <a href={$user['link']} class="myclass"> {$user['name']} </a>; } } echo <user:link userid={26}/>;
  8. echo <div class="myclass">Hello World!!</div>; Will be replaced with echo new xhp_div( array('class' => 'myclass'), array('Hello World!!') );