What the Haxe?

?

Runs anywhere

JavaScript, C++, PHP, Python, Lua, C, C#, Java, HashLink, NekoVM, FlashPlayer

Does everything

OOP, FP, LOP, AOP. Nominal & structural subtyping, type inference, GADT, pattern matching, abstract data types,

static extension, compile time metaprogramming ...

Haxe is a language unicorn.

TFW explaining Haxe

Secret Services

?

Healthcare

TiVo

Game Developers

Game Developer Barbie

15
Years
Ago

Still a thing

  • Netscape, iCab, IE for Mac
  • PHP4, register_globals
  • Java Applets, RealPlayer, ...

Yet to come

  • Rails, Django, Symfony, Zend, ASP.NET MVC, ...
  • jQuery, Ext.js, YUI, GWT, Silverlight, ...
  • JSON
  • Facebook, Youtube, Twitter
  • Intel Macs, usable desktop Linux, Smartphones
  • node.js, bower, npm, browserify, webpack, ...
  • Safari, Chrome

A taste of early 2004

RIA

PITA

  • browsers were a PITA
  • backend development was a PITA
  • programming with three different languages was a PITA
  • exchanging data between three different runtimes was a horrible PITA 

MotionTwin

  • ActionScriptMetaLanguage
  • MotionTypes and MTASC
  • NekoVM
    • byte code interpreter
    • dynamic
    • prototype based
    • with JIT

2006: haXe

  • one single language to target everything

  • JavaScript typings that worked

  • transparent communication between platforms

Full stack development as it should be!!

Expected reaction

Real Reaction

Why though?

Things change!

  • Haxe Foundation
  • Haxe team
  • manual, cook book
  • vshaxe
  • still crazy
  • still Spartan
  • no major backing
  • one man show
  • lack of documentation
  • limited tooling
  • too crazy
  • overall too Spartan

It's 2019 now, why bother?

Language quality

  • type system
  • macro system
  • compiler speed
  • maturity

True native code

Compile to Java or C++ to target Android and iOS respectively

HaxeUI

Haxe at Docler

Prelude

  • rewrite Flash part in AS3
    • second system syndrome
    • enormous complexity, compensated by Flash
  • Apple announces FlashPlayer deadline
  • Panic!!!
  • direct port to Haxe, assisted with as3hx to get started

Business critical product:

Things happen:

Result

After ~1 year:

  • one ~5MB JavaScript file
  • provided little more than core functionality
  • pretty buggy and slooooooooow

Reaction

Mistakes were made

  • started with huge legacy
  • not leveraging Haxe's strength
  • cumbersome, enterprisey patterns used for simple things
  • not a real web app

Things we needed

  • template system instead of innerHTML and querySelector
  • declarative data binding instead of controller jungle
  • simpler mechanisms for composing decoupled parts of the application

The Plan

  • observable data layer with support for derived states
  • unidirectional data flow
  • descriptive UI markup

So ... we need React + MobX?

The Implementation

  • type safe template system (HXX = JSX - JS = HX), capable of producing DOM and vDOM, rendered through virtual-dom
  • lightweight implementation of observables (think of a mix of knockout.js cold and observables from RxJS)
  • coconut: state management and ui component framework forming a cohesive stack

Expected reaction

Real Reaction

Slow and Steady

So, no React then?

  • React based rendering implemented and passed QA
  • to be shipped "soon"
  • smooth transition, with small change in the end:
89 files changed, 376 insertions(+), 427 deletions(-)

LOP

teach your compiler

And much more ...

Time to spread the love!

WTH?

By Juraj Kirchheim

WTH?

  • 974