Haxe Function Signatures



Just a quick note about this function signature:

Dynamic -> Void

Dynamic generally means any type in Haxe. However, it does not mean Void.

For example, if you have this:

var func:Dynamic -> Void;

You cannot assign func a function that has a void parameter list. It DOES require a parameter, but that parameter can be of any type.

IE, this is bad:

function foo() {}

// foo is of type Void -> Void, not Dynamic -> Void
func = foo;

But this is good:

function foo(bar:Dynamic) {}

func = foo;

It may seem kinda obvious, but I was tripped up on it because I thought Dynamic could represent any type of value, including a Void parameter list. Which, in hindsight, seems kind of ridiculous, but none-the-less, it happened.

NOTE This was written for Haxe 2.10