I absolutely love module-level fields, fantastic release everyone.
Could you shed some more light on the following:
jvm : added -D jvm.dynamic-level to control the amount of dynamic support code being generated. 0 = none, 1 = field read/write optimization (default), 2 = compile-time method closures
This is in the context of dynamic access to methods. Each class generates a _hx_getField method for read-access, which you can pretend looks something like this:
return switch (fieldName) {
#if (jvm.dynamic_level >= 1)
case "someVariable": this.someVariable;
#end
#if (jvm.dynamic_level >= 2)
case "someMethod": new CurrentClass_someMethod(this);
#else
case "someMethod": haxe.jvm.Jvm.readFieldClosure(this, "someMethod", [argumentTypes]);
#end
default: // Slow dynamic default routing
}
In other words, with a level >= 2 you’ll get a compile-time closure instance for every method. This can make things faster in highly dynamic code, but it definitely makes the output much bigger.