2.1.6 Optional Arguments and Nullability

Optional arguments must be accounted for when considering nullability; a separation between native optional arguments which are not nullable and Haxe-specific optional arguments which may be needs to be defined. This distinction is made using the question-mark optional argument:

// x is a native Int (not nullable)
function foo(x : Int = 0) {}
// y is Null<Int> (nullable)
function bar( ?y : Int) {}
// z is also Null<Int>
function opt( ?z : Int = -1) {}
Trivia: Argument vs. Parameter

In some other programming languages, argument and parameter are used interchangeably. In Haxe, argument is used when referring to methods and parameter refers to Type Parameters.