... shudders
... shudders
Conditional compilation is a horrible, horrible idea period, and is particularly easy to turn into an indecipherable brittle mess in haxe. This was made worse by the previous authors of the code we inherited, but is really a case where it’s the tool’s (haxe’s) fault for implementing the feature in a way that makes it an intrinsic foot gun.
Lastly, it was a big turn off to our candidates, and many people we interviewed expressed lack of interest in working with it.
I will agree to your point about abandoned third party tools but that happens with any language? It’s just more pronounced on a less popular one. I will also agree about the code it produces: the point of a transpiled language isn’t for its output to necessarily be readable but first and foremost fast. You wouldnt expect c to produce understandable assembly in all cases, would you? Plus it maps all lines to your Haxe source so you shouldn’t even have to debug large blocks of native code anyway.
What necessarily does Haxe do that makes for conditional compilation to be so bad? AFAIK it works in the exact same way other cross platform frameworks have it (eg, Unity)- it’s probably the cleanest way to do it; I certainly wouldn’t say it promotes brittle code practices at all, but ofc, like anything, can be misused.
I can see it being a potential turnoff to candidates given it’s relatively unknown status... but the language itself reads and writes like a C-style OOP language: there’s nothing that should necessarily turn people off besides that it’s an unknown, especially anyone coming from a C or Java background.
I would like to argue about this philosophy. When your target output is not readable, then you restrict the developer to work inside your upper-level language. This is fine if your upper layer is robust and transparent enough to reason about. In C's case, there is rarely a case one needs to work at the assembly level to reason/debug. Is this the case for Haxe? Now if you even imply that developer need work in your output layer even one percent of the time, then it is responsible to make sure the output is readable. Otherwise, it is a gun shooting the foot -- even only 1% of the time.
The background is that I love C. I find C very straightforward to reason about and very simplistic to allow more logic to be spelled out in a clean way (than C++ for example). Now the above passage -- putting assembly as an analogy to C -- sounds prickly.
The manual doesn't really go into enough detail to imply you'd need to fiddle with the outputted code but I'd imagine any case would be a bug rather than a feature.
I think the analogy is accurate: Haxe is not meant to be used to compile to native and then modified in native further. It can be... but the general usecase is to write everything in Haxe and not have to then modify the transpiled result. Similar to typescript in a way... you can add JavaScript after the fact, but most likely you’d directly add native untyped JavaScript within your Typescript code, not directly to your transpiled result.
One thing that gets me is that the Input/Output section of the official manual [0] has gone unwritten for quite a while, now. [1]