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.

3 Likes

Thx for your reply

Haxe 4.3.0 isn’t in Linux Mint repos, only 4.2.4 is available unfortunately, so I’ve upgraded using:

sudo add-apt-repository ppa:haxe/releases -y
sudo apt-get update
sudo apt-get install haxe -y

Which upgraded haxe to 4.3.6

Followed the instructions in the git repo above for “Compiling the demo project to html5” and “Running the server” and it works. And it works even better by “Running the server” first and “Compiling the demo project to html5” after. Of course.

1 Like

Hi jul, great that you manage to upgrade and compile ! :partying_face: You might be interested in lix which allows to manage dependencies (haxe version, libs..) on a per-project basis, which makes them independent from each other and from what is installed/available on the system, now or in a few years. It’s lightweight, well maintained and a real time-saver in my experience :slight_smile:

2 Likes