One year of Haxe

Nicolas Cannasse
@ncannasse
WWX 2014

One Year Of Haxe

3.1.x

Pattern matching

	switch( stringValue ) {
	case _.toLowerCase() => "foo": ...
	case nospace(_) => x if( x != "" ): x;
	}
	
	function nospace(x:String) {
		return ~/[ \t\r\n]+/g.replace(x,"");
	}
	

Abstract enums

	@:enum abstract A(String) {
		var X = "X";
		var Y = "Y";
		var Z = "Z";
	}
	

New Syntax

	var f = (expression : Type);
	
	// example
	Reflect.setField(obj,"name",(foo() : String));
	

EnumValue.match

	myEnum.match(pattern)
	
	// example
	if( macroExpr.match({ expr : EConst(CIdent(_)) }) ) ...
	

Std.instance

	function instance<T:{},S:T>( value : T, c : Class<S> ) : S;
	
	// example
	class A {}
	class B extends A {}
	class C {}
	...
	var a : A = new B();
	Std.instance(a,B); // ok
	Std.instance(a,C); // error
	

Compiler Cache Memory

Haxe 3.2 plans

Bytes API

Unicode Support

What is a String?

Various Encodings

  Char range Bytes/char Access
ANSI 0x00-0x7F 1 O(1)
ISO 0x00-0xFF 1 O(1)
UCS2 0x00-0xFFFF 2 O(1)
UTF8 0x00-0x7FFFFFFF 1-6 O(n)
UTF16 0x00-0xD7FF
+ 0xE000-0x10FFFF
2 (+2) O(n)*

(*) : unless we ignore surrogate pairs

UTF8 for file storage / HTML (superset of ANSI)

UTF-16 in details

What to do?

A few other things

Python target

Haxe Foundation

Who?

What?

What?

http://haxe.org

New haxe.org

Other HF Activities

Thank you!

And don't forget...

Done with http://github.com/ncannasse/hxslides