Standard Haxe supports local static variables within functions to persist data between calls (as documented in the Haxe Manual).
Say we have this example code:
static function getData() {
static var cache:Null<String> = null;
if (cache == null) {
cache = slowOperation();
}
return cache;
}
static function slowOperation() {
trace("performing slow operation...");
return "result";
}
static public function main() {
trace(getData()); // performing slow operation... result
trace(getData()); // result
}
In haxe environments (expected behavior) we get this result:
performing slow operation... result
result
result
But in polymod this happens:
ERROR Error while parsing script assets/scripts/WorstCParser.hxc#11: EUnexpected
Unexpected error: Unexpected token "var", is there invalid syntax on this line?
Standard Haxe supports local static variables within functions to persist data between calls (as documented in the Haxe Manual).
Say we have this example code:
In haxe environments (expected behavior) we get this result:
But in polymod this happens: