SlideShare a Scribd company logo
1 of 42
Download to read offline
Haxe 
Cross-platform in French 
Sergei Egorov / @bsideup 
0
About me 
Senior Server Developer at Creative Mobile 
Haxe user since 2008 
Introduced Haxe in our company
What is Haxe? 
First release in April 2006 
Open source language 
Strictly typed 
Developed by Nicolas Cannasse 
(Well known in Flash community thanks to MTASC compiler)
Why Haxe is cool? 
Cross-platform OOP language 
Good syntax 
Provides good API for extending language 
Generates sources for target language 
Big community 
Haxelib - repository for your Haxe libs 
online REPL try.haxe.org
Who thinks Haxe is cool?
Meet my hipster friend 
and he don't trust me that Haxe is cool
"But why?" I said. Look at it: 
var arr = [for (i in 0...10) if (i%2==0) i]; 
var value = 1; 
function myLocalFunction(i) : {num: Int} { 
return if(i % 2 == 0) { 
{num : value + i}; 
} else { 
{num : value}; 
}; 
} 
trace(myLocalFunction(arr[1]).num); // 3
Why I need another JavaScript?
It's not JS! We have classes:) 
interface Placeable<T> { 
public var x:T; 
public var y:T; 
} 
class Main implements Placeable<Float> { 
public var x:Float; 
public var y:Float; 
public function new() { 
trace("I'm constructor!"); 
} 
}
OOP is so old-school. I want more!
How about abstract types? 
abstract StringSplitter(Array<String>) { 
inline function new(a:Array<String>) 
this = a; 
@:from 
static public inline function fromString(s:String) { 
return new StringSplitter(s.split("")); 
} 
} 
var splitter:StringSplitter = "Hello"; 
trace(splitter); // [H,e,l,l,o]
I don't get it. Anything else?
Static extensions? 
class IntExtender { 
static public function triple(i:Int) { 
return i * 3; 
} 
} 
using IntExtender; 
trace(12.triple());
Not bad, no need to use prototypes.
We have algebraic data types too 
enum Color3 { 
Red; 
Green; 
Blue; 
Rgb( r : Int, g : Int, b : Int ); 
Alpha( a : Int, col : Color3 ); 
} 
function toInt( c : Color3 ) : Int { 
return switch( c ) { 
case Red: 0xFF0000; 
case Green: 0x00FF00; 
case Blue: 0x0000FF; 
case Rgb(r,g,b): (r << 16) | (g << 8) | b; 
case Alpha(a,c): (a << 24) | (toInt(c) & 0xFFFFFF); 
} 
}
Ok. Not so bad. Another JavaScript generator.
Not JS only. 
It's cross-platform!
How many languages do you know 
who can be compiled to:
JavaScript
Java?
C/C++?
C#?
Objective-C?
Python?
PHP?
ActionScript?
All of them!
Cross-platform 
Haxe Others
Conditional compilation 
for platform-specific code 
#if flash8 
// Haxe code specific for flash player 8 
#elseif flash 
// Haxe code specific for flash platform (any version) 
#elseif js 
// Haxe code specific for javascript plaform 
#elseif neko 
// Haxe code specific for neko plaform
Platform-specific magic functions 
//ActionScript: Valid reference 
untyped __global__["flash.display.DisplayObject"]; 
// JavaScript: Call code 
untyped __js__("Navigator.plugin["Shockwave Flash"]"); 
// PHP: value of $_SERVER['REQUEST_METHOD'] 
untyped __var__('_SERVER', 'REQUEST_METHOD') 
// C# 
var str:String = "test untyped"; 
untyped __cs__("System.Console.WriteLine(str)"); 
// Java 
untyped __java__("java.lang.System.out.println(str)");
STD lib for each target platform 
cpp.Lib 
flash.Lib 
java.Lib 
js.Lib 
php.Lib 
...
Nothing is perfect.
Yes! So...
Haxe shortcomings 
Not-so-good IDE support: 
Good support in FlashDevelop (Windows only) 
Limited support in IntelliJ IDEA for all platforms 
Few other IDEs like FDT 
Verbosity (i.e. no short lambdas) 
Written in OCaml:)
Haxe 
at Creative Mobile
Drag Racing Social
Drag Racing Social 
Simulation library port from Java to Haxe 
Main functionality in game 
Same simulation code base for client and server 
Not afraid of floating point 
Good performance!
One more thing
Gradle Haxe plugin! 
Created by me:) 
Compile Haxe with Gradle build system 
Basic haxelib support 
Multi-target aware 
Source code: 
https://github.com/bsideup/graxe
Example configuration 
haxe { 
targets { 
swf { 
mainClass "TestSwf" 
} 
java { 
mainClass "TestJava" 
} 
} 
} 
dependencies { 
compile project(":libraryModule") 
compile haxeLib("tjson", "1.2.3") 
}
Demo
Questions?

More Related Content

What's hot

C++17 not your father’s c++
C++17  not your father’s c++C++17  not your father’s c++
C++17 not your father’s c++Patrick Viafore
 
Scala implicits
Scala implicitsScala implicits
Scala implicitsnkpart
 
[C++ korea] effective modern c++ study item 3 understand decltype +이동우
[C++ korea] effective modern c++ study   item 3 understand decltype +이동우[C++ korea] effective modern c++ study   item 3 understand decltype +이동우
[C++ korea] effective modern c++ study item 3 understand decltype +이동우Seok-joon Yun
 
1 introduction to c program
1 introduction to c program1 introduction to c program
1 introduction to c programNishmaNJ
 
devLink - What's New in C# 4?
devLink - What's New in C# 4?devLink - What's New in C# 4?
devLink - What's New in C# 4?Kevin Pilch
 
Unmanaged Parallelization via P/Invoke
Unmanaged Parallelization via P/InvokeUnmanaged Parallelization via P/Invoke
Unmanaged Parallelization via P/InvokeDmitri Nesteruk
 
02 Php Vars Op Control Etc
02 Php Vars Op Control Etc02 Php Vars Op Control Etc
02 Php Vars Op Control EtcGeshan Manandhar
 
Développer un moteur d'exécution symbolique en partant de rien
Développer un moteur d'exécution symbolique en partant de rienDévelopper un moteur d'exécution symbolique en partant de rien
Développer un moteur d'exécution symbolique en partant de rienJUG Lausanne
 
Large Scale JavaScript with TypeScript
Large Scale JavaScript with TypeScriptLarge Scale JavaScript with TypeScript
Large Scale JavaScript with TypeScriptOliver Zeigermann
 
Diving into HHVM Extensions (Brno PHP Conference 2015)
Diving into HHVM Extensions (Brno PHP Conference 2015)Diving into HHVM Extensions (Brno PHP Conference 2015)
Diving into HHVM Extensions (Brno PHP Conference 2015)James Titcumb
 
TDD in C - Recently Used List Kata
TDD in C - Recently Used List KataTDD in C - Recently Used List Kata
TDD in C - Recently Used List KataOlve Maudal
 
Core Java Meetup #9 - Quiz Questions - 6th May
Core Java Meetup #9 - Quiz Questions - 6th MayCore Java Meetup #9 - Quiz Questions - 6th May
Core Java Meetup #9 - Quiz Questions - 6th MayCodeOps Technologies LLP
 
Empty Base Class Optimisation, [[no_unique_address]] and other C++20 Attributes
Empty Base Class Optimisation, [[no_unique_address]] and other C++20 AttributesEmpty Base Class Optimisation, [[no_unique_address]] and other C++20 Attributes
Empty Base Class Optimisation, [[no_unique_address]] and other C++20 AttributesBartlomiej Filipek
 
computer notes - Data Structures - 8
computer notes - Data Structures - 8computer notes - Data Structures - 8
computer notes - Data Structures - 8ecomputernotes
 
OpenGurukul : Language : C++ Programming
OpenGurukul : Language : C++ ProgrammingOpenGurukul : Language : C++ Programming
OpenGurukul : Language : C++ ProgrammingOpen Gurukul
 

What's hot (20)

C++17 not your father’s c++
C++17  not your father’s c++C++17  not your father’s c++
C++17 not your father’s c++
 
C programming
C programming C programming
C programming
 
Scala implicits
Scala implicitsScala implicits
Scala implicits
 
[C++ korea] effective modern c++ study item 3 understand decltype +이동우
[C++ korea] effective modern c++ study   item 3 understand decltype +이동우[C++ korea] effective modern c++ study   item 3 understand decltype +이동우
[C++ korea] effective modern c++ study item 3 understand decltype +이동우
 
1 introduction to c program
1 introduction to c program1 introduction to c program
1 introduction to c program
 
devLink - What's New in C# 4?
devLink - What's New in C# 4?devLink - What's New in C# 4?
devLink - What's New in C# 4?
 
Unmanaged Parallelization via P/Invoke
Unmanaged Parallelization via P/InvokeUnmanaged Parallelization via P/Invoke
Unmanaged Parallelization via P/Invoke
 
02 Php Vars Op Control Etc
02 Php Vars Op Control Etc02 Php Vars Op Control Etc
02 Php Vars Op Control Etc
 
Php 5.6
Php 5.6Php 5.6
Php 5.6
 
Développer un moteur d'exécution symbolique en partant de rien
Développer un moteur d'exécution symbolique en partant de rienDévelopper un moteur d'exécution symbolique en partant de rien
Développer un moteur d'exécution symbolique en partant de rien
 
Large Scale JavaScript with TypeScript
Large Scale JavaScript with TypeScriptLarge Scale JavaScript with TypeScript
Large Scale JavaScript with TypeScript
 
Diving into HHVM Extensions (Brno PHP Conference 2015)
Diving into HHVM Extensions (Brno PHP Conference 2015)Diving into HHVM Extensions (Brno PHP Conference 2015)
Diving into HHVM Extensions (Brno PHP Conference 2015)
 
TDD in C - Recently Used List Kata
TDD in C - Recently Used List KataTDD in C - Recently Used List Kata
TDD in C - Recently Used List Kata
 
C++ via C#
C++ via C#C++ via C#
C++ via C#
 
Core Java Meetup #9 - Quiz Questions - 6th May
Core Java Meetup #9 - Quiz Questions - 6th MayCore Java Meetup #9 - Quiz Questions - 6th May
Core Java Meetup #9 - Quiz Questions - 6th May
 
Empty Base Class Optimisation, [[no_unique_address]] and other C++20 Attributes
Empty Base Class Optimisation, [[no_unique_address]] and other C++20 AttributesEmpty Base Class Optimisation, [[no_unique_address]] and other C++20 Attributes
Empty Base Class Optimisation, [[no_unique_address]] and other C++20 Attributes
 
Lập trình C
Lập trình CLập trình C
Lập trình C
 
computer notes - Data Structures - 8
computer notes - Data Structures - 8computer notes - Data Structures - 8
computer notes - Data Structures - 8
 
OpenGurukul : Language : C++ Programming
OpenGurukul : Language : C++ ProgrammingOpenGurukul : Language : C++ Programming
OpenGurukul : Language : C++ Programming
 
MP in Clojure
MP in ClojureMP in Clojure
MP in Clojure
 

Similar to Haxe by sergei egorov

Diving into HHVM Extensions (php[tek] 2016)
Diving into HHVM Extensions (php[tek] 2016)Diving into HHVM Extensions (php[tek] 2016)
Diving into HHVM Extensions (php[tek] 2016)James Titcumb
 
PHP 8: Process & Fixing Insanity
PHP 8: Process & Fixing InsanityPHP 8: Process & Fixing Insanity
PHP 8: Process & Fixing InsanityGeorgePeterBanyard
 
Clean & Typechecked JS
Clean & Typechecked JSClean & Typechecked JS
Clean & Typechecked JSArthur Puthin
 
Groovy Introduction - JAX Germany - 2008
Groovy Introduction - JAX Germany - 2008Groovy Introduction - JAX Germany - 2008
Groovy Introduction - JAX Germany - 2008Guillaume Laforge
 
The Evolution of Async-Programming on .NET Platform (.Net China, C#)
The Evolution of Async-Programming on .NET Platform (.Net China, C#)The Evolution of Async-Programming on .NET Platform (.Net China, C#)
The Evolution of Async-Programming on .NET Platform (.Net China, C#)jeffz
 
Haxe: What Makes It Cool
Haxe: What Makes It CoolHaxe: What Makes It Cool
Haxe: What Makes It CooleddieSullivan
 
golang_getting_started.pptx
golang_getting_started.pptxgolang_getting_started.pptx
golang_getting_started.pptxGuy Komari
 
Introduction To Groovy 2005
Introduction To Groovy 2005Introduction To Groovy 2005
Introduction To Groovy 2005Tugdual Grall
 
Static types on javascript?! Type checking approaches to ensure healthy appli...
Static types on javascript?! Type checking approaches to ensure healthy appli...Static types on javascript?! Type checking approaches to ensure healthy appli...
Static types on javascript?! Type checking approaches to ensure healthy appli...Arthur Puthin
 
2007 09 10 Fzi Training Groovy Grails V Ws
2007 09 10 Fzi Training Groovy Grails V Ws2007 09 10 Fzi Training Groovy Grails V Ws
2007 09 10 Fzi Training Groovy Grails V Wsloffenauer
 
Why Java Sucks and C# Rocks (Final)
Why Java Sucks and C# Rocks (Final)Why Java Sucks and C# Rocks (Final)
Why Java Sucks and C# Rocks (Final)jeffz
 
Complete Notes on Angular 2 and TypeScript
Complete Notes on Angular 2 and TypeScriptComplete Notes on Angular 2 and TypeScript
Complete Notes on Angular 2 and TypeScriptEPAM Systems
 
What can be done with Java, but should better be done with Erlang (@pavlobaron)
What can be done with Java, but should better be done with Erlang (@pavlobaron)What can be done with Java, but should better be done with Erlang (@pavlobaron)
What can be done with Java, but should better be done with Erlang (@pavlobaron)Pavlo Baron
 
Oh Crap, I Forgot (Or Never Learned) C! [CodeMash 2010]
Oh Crap, I Forgot (Or Never Learned) C! [CodeMash 2010]Oh Crap, I Forgot (Or Never Learned) C! [CodeMash 2010]
Oh Crap, I Forgot (Or Never Learned) C! [CodeMash 2010]Chris Adamson
 
Introduction to clojure
Introduction to clojureIntroduction to clojure
Introduction to clojureAbbas Raza
 
Nikita Popov "What’s new in PHP 8.0?"
Nikita Popov "What’s new in PHP 8.0?"Nikita Popov "What’s new in PHP 8.0?"
Nikita Popov "What’s new in PHP 8.0?"Fwdays
 

Similar to Haxe by sergei egorov (20)

Diving into HHVM Extensions (php[tek] 2016)
Diving into HHVM Extensions (php[tek] 2016)Diving into HHVM Extensions (php[tek] 2016)
Diving into HHVM Extensions (php[tek] 2016)
 
PHP 8: Process & Fixing Insanity
PHP 8: Process & Fixing InsanityPHP 8: Process & Fixing Insanity
PHP 8: Process & Fixing Insanity
 
Clean & Typechecked JS
Clean & Typechecked JSClean & Typechecked JS
Clean & Typechecked JS
 
Effective Object Oriented Design in Cpp
Effective Object Oriented Design in CppEffective Object Oriented Design in Cpp
Effective Object Oriented Design in Cpp
 
Groovy Introduction - JAX Germany - 2008
Groovy Introduction - JAX Germany - 2008Groovy Introduction - JAX Germany - 2008
Groovy Introduction - JAX Germany - 2008
 
The Evolution of Async-Programming on .NET Platform (.Net China, C#)
The Evolution of Async-Programming on .NET Platform (.Net China, C#)The Evolution of Async-Programming on .NET Platform (.Net China, C#)
The Evolution of Async-Programming on .NET Platform (.Net China, C#)
 
Haxe: What Makes It Cool
Haxe: What Makes It CoolHaxe: What Makes It Cool
Haxe: What Makes It Cool
 
golang_getting_started.pptx
golang_getting_started.pptxgolang_getting_started.pptx
golang_getting_started.pptx
 
Introduction To Groovy 2005
Introduction To Groovy 2005Introduction To Groovy 2005
Introduction To Groovy 2005
 
Static types on javascript?! Type checking approaches to ensure healthy appli...
Static types on javascript?! Type checking approaches to ensure healthy appli...Static types on javascript?! Type checking approaches to ensure healthy appli...
Static types on javascript?! Type checking approaches to ensure healthy appli...
 
2007 09 10 Fzi Training Groovy Grails V Ws
2007 09 10 Fzi Training Groovy Grails V Ws2007 09 10 Fzi Training Groovy Grails V Ws
2007 09 10 Fzi Training Groovy Grails V Ws
 
Rits Brown Bag - TypeScript
Rits Brown Bag - TypeScriptRits Brown Bag - TypeScript
Rits Brown Bag - TypeScript
 
Why Java Sucks and C# Rocks (Final)
Why Java Sucks and C# Rocks (Final)Why Java Sucks and C# Rocks (Final)
Why Java Sucks and C# Rocks (Final)
 
Complete Notes on Angular 2 and TypeScript
Complete Notes on Angular 2 and TypeScriptComplete Notes on Angular 2 and TypeScript
Complete Notes on Angular 2 and TypeScript
 
Dart
DartDart
Dart
 
What can be done with Java, but should better be done with Erlang (@pavlobaron)
What can be done with Java, but should better be done with Erlang (@pavlobaron)What can be done with Java, but should better be done with Erlang (@pavlobaron)
What can be done with Java, but should better be done with Erlang (@pavlobaron)
 
Oh Crap, I Forgot (Or Never Learned) C! [CodeMash 2010]
Oh Crap, I Forgot (Or Never Learned) C! [CodeMash 2010]Oh Crap, I Forgot (Or Never Learned) C! [CodeMash 2010]
Oh Crap, I Forgot (Or Never Learned) C! [CodeMash 2010]
 
C Tutorials
C TutorialsC Tutorials
C Tutorials
 
Introduction to clojure
Introduction to clojureIntroduction to clojure
Introduction to clojure
 
Nikita Popov "What’s new in PHP 8.0?"
Nikita Popov "What’s new in PHP 8.0?"Nikita Popov "What’s new in PHP 8.0?"
Nikita Popov "What’s new in PHP 8.0?"
 

Recently uploaded

LEVEL 5 - SESSION 1 2023 (1).pptx - PDF 123456
LEVEL 5   - SESSION 1 2023 (1).pptx - PDF 123456LEVEL 5   - SESSION 1 2023 (1).pptx - PDF 123456
LEVEL 5 - SESSION 1 2023 (1).pptx - PDF 123456KiaraTiradoMicha
 
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...panagenda
 
A Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxA Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxComplianceQuest1
 
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfkalichargn70th171
 
%in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park %in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park masabamasaba
 
AI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplateAI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplatePresentation.STUDIO
 
Exploring the Best Video Editing App.pdf
Exploring the Best Video Editing App.pdfExploring the Best Video Editing App.pdf
Exploring the Best Video Editing App.pdfproinshot.com
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️Delhi Call girls
 
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...ICS
 
The Top App Development Trends Shaping the Industry in 2024-25 .pdf
The Top App Development Trends Shaping the Industry in 2024-25 .pdfThe Top App Development Trends Shaping the Industry in 2024-25 .pdf
The Top App Development Trends Shaping the Industry in 2024-25 .pdfayushiqss
 
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM TechniquesAI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM TechniquesVictorSzoltysek
 
8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech students8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech studentsHimanshiGarg82
 
Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsJhone kinadey
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVshikhaohhpro
 
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Steffen Staab
 
The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...
The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...
The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...kalichargn70th171
 
%in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park %in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park masabamasaba
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfkalichargn70th171
 
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrainmasabamasaba
 
BUS PASS MANGEMENT SYSTEM USING PHP.pptx
BUS PASS MANGEMENT SYSTEM USING PHP.pptxBUS PASS MANGEMENT SYSTEM USING PHP.pptx
BUS PASS MANGEMENT SYSTEM USING PHP.pptxalwaysnagaraju26
 

Recently uploaded (20)

LEVEL 5 - SESSION 1 2023 (1).pptx - PDF 123456
LEVEL 5   - SESSION 1 2023 (1).pptx - PDF 123456LEVEL 5   - SESSION 1 2023 (1).pptx - PDF 123456
LEVEL 5 - SESSION 1 2023 (1).pptx - PDF 123456
 
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
 
A Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxA Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docx
 
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
 
%in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park %in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park
 
AI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplateAI & Machine Learning Presentation Template
AI & Machine Learning Presentation Template
 
Exploring the Best Video Editing App.pdf
Exploring the Best Video Editing App.pdfExploring the Best Video Editing App.pdf
Exploring the Best Video Editing App.pdf
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
 
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
 
The Top App Development Trends Shaping the Industry in 2024-25 .pdf
The Top App Development Trends Shaping the Industry in 2024-25 .pdfThe Top App Development Trends Shaping the Industry in 2024-25 .pdf
The Top App Development Trends Shaping the Industry in 2024-25 .pdf
 
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM TechniquesAI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
 
8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech students8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech students
 
Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial Goals
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTV
 
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
 
The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...
The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...
The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...
 
%in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park %in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
 
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
 
BUS PASS MANGEMENT SYSTEM USING PHP.pptx
BUS PASS MANGEMENT SYSTEM USING PHP.pptxBUS PASS MANGEMENT SYSTEM USING PHP.pptx
BUS PASS MANGEMENT SYSTEM USING PHP.pptx
 

Haxe by sergei egorov

  • 1. Haxe Cross-platform in French Sergei Egorov / @bsideup 0
  • 2. About me Senior Server Developer at Creative Mobile Haxe user since 2008 Introduced Haxe in our company
  • 3. What is Haxe? First release in April 2006 Open source language Strictly typed Developed by Nicolas Cannasse (Well known in Flash community thanks to MTASC compiler)
  • 4. Why Haxe is cool? Cross-platform OOP language Good syntax Provides good API for extending language Generates sources for target language Big community Haxelib - repository for your Haxe libs online REPL try.haxe.org
  • 5. Who thinks Haxe is cool?
  • 6. Meet my hipster friend and he don't trust me that Haxe is cool
  • 7. "But why?" I said. Look at it: var arr = [for (i in 0...10) if (i%2==0) i]; var value = 1; function myLocalFunction(i) : {num: Int} { return if(i % 2 == 0) { {num : value + i}; } else { {num : value}; }; } trace(myLocalFunction(arr[1]).num); // 3
  • 8. Why I need another JavaScript?
  • 9. It's not JS! We have classes:) interface Placeable<T> { public var x:T; public var y:T; } class Main implements Placeable<Float> { public var x:Float; public var y:Float; public function new() { trace("I'm constructor!"); } }
  • 10. OOP is so old-school. I want more!
  • 11. How about abstract types? abstract StringSplitter(Array<String>) { inline function new(a:Array<String>) this = a; @:from static public inline function fromString(s:String) { return new StringSplitter(s.split("")); } } var splitter:StringSplitter = "Hello"; trace(splitter); // [H,e,l,l,o]
  • 12. I don't get it. Anything else?
  • 13. Static extensions? class IntExtender { static public function triple(i:Int) { return i * 3; } } using IntExtender; trace(12.triple());
  • 14. Not bad, no need to use prototypes.
  • 15. We have algebraic data types too enum Color3 { Red; Green; Blue; Rgb( r : Int, g : Int, b : Int ); Alpha( a : Int, col : Color3 ); } function toInt( c : Color3 ) : Int { return switch( c ) { case Red: 0xFF0000; case Green: 0x00FF00; case Blue: 0x0000FF; case Rgb(r,g,b): (r << 16) | (g << 8) | b; case Alpha(a,c): (a << 24) | (toInt(c) & 0xFFFFFF); } }
  • 16. Ok. Not so bad. Another JavaScript generator.
  • 17. Not JS only. It's cross-platform!
  • 18. How many languages do you know who can be compiled to:
  • 20. Java?
  • 22. C#?
  • 25. PHP?
  • 29. Conditional compilation for platform-specific code #if flash8 // Haxe code specific for flash player 8 #elseif flash // Haxe code specific for flash platform (any version) #elseif js // Haxe code specific for javascript plaform #elseif neko // Haxe code specific for neko plaform
  • 30. Platform-specific magic functions //ActionScript: Valid reference untyped __global__["flash.display.DisplayObject"]; // JavaScript: Call code untyped __js__("Navigator.plugin["Shockwave Flash"]"); // PHP: value of $_SERVER['REQUEST_METHOD'] untyped __var__('_SERVER', 'REQUEST_METHOD') // C# var str:String = "test untyped"; untyped __cs__("System.Console.WriteLine(str)"); // Java untyped __java__("java.lang.System.out.println(str)");
  • 31. STD lib for each target platform cpp.Lib flash.Lib java.Lib js.Lib php.Lib ...
  • 34. Haxe shortcomings Not-so-good IDE support: Good support in FlashDevelop (Windows only) Limited support in IntelliJ IDEA for all platforms Few other IDEs like FDT Verbosity (i.e. no short lambdas) Written in OCaml:)
  • 37. Drag Racing Social Simulation library port from Java to Haxe Main functionality in game Same simulation code base for client and server Not afraid of floating point Good performance!
  • 39. Gradle Haxe plugin! Created by me:) Compile Haxe with Gradle build system Basic haxelib support Multi-target aware Source code: https://github.com/bsideup/graxe
  • 40. Example configuration haxe { targets { swf { mainClass "TestSwf" } java { mainClass "TestJava" } } } dependencies { compile project(":libraryModule") compile haxeLib("tjson", "1.2.3") }
  • 41. Demo