Problem with haxe 4 rc 4 and variable compiler version

hello with haxe 4 rc 4 i get this error on thx core library in Options.hx:145: characters 9-20 : Cannot compare string “4.0.0-rc.4” and float 3.2
in this line #if ((haxe <= 3.2) && java) @:generic #end

That code makes no sense, the haxe define was only added recently, so that comparison wouldn’t have worked in 3.2. It should’ve been haxe_ver <= 3.2.

The haxe define is for the new SemVer comparison syntax:

#if (haxe >= version("4.0.0-rc.4"))

Note that version() doesn’t parse in Haxe versions before 4.0.0-rc.3, so once you use it you lose backwards compatibility with Haxe versions older than that.

yes but this code (thx.core/Options.hx at master · fponticelli/thx.core · GitHub) with rc 3 works. what is changed with rc 4? i don’t understand why

and this file isn’t changed from 2017

As I mentioned, what changed is that the haxe define is now defined, so instead of having no value, it has a value of "4.0.0-rc.4". And that can’t be compared to a float.

maybe that haxe npm define this?

What? No, the compiler defines haxe.

i have only update haxe npm from rc3 to rc4 the haxe libs are the same. with rc4 i hace this error. i don’t understand why the compile variable haxe has "4.0.0-rc.4" instead of 4

As mentioned before…

ok sorry i have see that there is a pull request that resolve the problem fix haxe version check by andyli · Pull Request #273 · fponticelli/thx.core · GitHub

but is strange because this code has always work before rc4

That’s what I’ve been trying to tell you, it hasn’t worked… Essentially that was dead code because the condition would never have evaluated to true.

1 Like

thanks now understand