Haxe 4.2.4 and colyseus-haxe problem

I’m trying to use this:

However I get the following error when I try to compile with “lime test html5” :

../../src/io/colyseus/serializer/schema/Decoder.hx:326: characters 34-35 : Unexpected ?

Any idea/workaround to fix this?

I looked at the docs for null coalescing here ( Null coalescing - Haxe - The Cross-platform Toolkit ) and it seems it was introduced in Haxe version 4.3.0, which is later than the version you are using. Your compiler thus only knows of ‘?’ in the context of the ternary operator, and isn’t expecting a second ‘?’, since it isn’t yet part of its grammar.

You should be able to rewrite that specific line just without the null coalescing operator, as something like:

? (previousValue != null ? previousValue : refs.get(refId))

I’m guessing that should work. I’m not setup to run a different version of the compiler at the moment, otherwise I would test it myself.

Edit: Oh, and I suppose it goes without saying that updating to the most recent (stable) version of Haxe would be a natural remedy, but I wrote my answer under the assumption that there may be a reason that you need to be on Haxe 4.2.4 in particular. If that isn’t the case, then updating would be ideal.

2 Likes