Syntax Question

This is more related to pure Haxe. What is the the most correct syntax mong the following 3 options?

var a:Array<Bitmap> = new Array<Bitmap>(); //this is very correct, but requires too much typing
var a = new Array<Bitmap>(); //this should be correct too, as it's from the haxe examples
var a:Array<Bitmap> = new Array(); //this is what I use in my code; the compiler doesn't show errors, but I doubt if this is OK for all platforms...

All three of these are valid, and strictly typed.

I prefer the second case for most code, because it is more concise (while still being clear in the type)

I sometimes let inference handle array types for me, though

var list = [];
list.push (bitmap);
1 Like