For haxe without Final or without ReadOnlyArray ( so slightly older Haxe ) you can use a function. Because I have inlined it the compiler will insert the String at the point were you call it - so you won’t have cost of the function call.
class Test {
static function main() {
trace( LIST() );
}
public static inline function LIST(){
return ["item1","item2","item3"];
}
}
generated JS
// Generated by Haxe 3.4.4
(function () { "use strict";
var Test = function() { };
Test.main = function() {
console.log(["item1","item2","item3"]);
};
Test.main();
})();