What’s the difference between a regular function, and a dynamic function?
dynamic functions are able to be redefined
class Main {
static dynamic function myDynamicFunction():String {
return 'hi';
}
static function main() {
trace(myDynamicFunction()); // this will trace hi
myDynamicFunction = function() {
return 'hello';
}
trace(myDynamicFunction()); // will trace hello since myDynamicFunction was redefined to return hello
}
}
more on them here Dynamic (Class Fields - Access Modifier) - Haxe - The Cross-platform Toolkit
ohhh, that’s cool
Btw, this is same thing as:
var myDynamicFunction:() -> String = () -> {...};