Due to potential new direction of D, I’m looking for some escape route just in case. I’m primarily a gamedev, so no functional programming languages like Rust or Haskell. Also one of the features I dislike the most in C/C++ is the super slow and super obsolete precompiler with its header files, so no zig, I don’t want to open two files for editing the same class/struct. Memory safety is nice to have, but not a requirement, at worst case scenario I’ll just create struct SafeArray<Type>
. Also I need optional OOP features instead of reinventing OOP with all kinds of hacks many do when I would need it.
Yes I know about OpenD, and could be a candidate for such things, just looking into alternatives.
Rust is the obvious answer, though I dunno how suitable it really is for games - the most popular game engine is Bevy and I’m not sure I like it too much. Also there seems to be much more focus on game technology than making actual games.
Don’t worry about it being “functional” though. It did support lots of FP features but the typical style is much more like imperative C++ than Haskell.
I would also look into Zig though.
I have talked to people about Rust gamedev (including those who left Rust for D due to gamedev), and it’s not a very good one, due to the functional aspects. Outsiders often joke about how Rust has more game engines than games.
Zig has the header file problem. Header files were originally created to get around memory limitations of old workstations, that no longer exist. They also complicate coding, since you now often have to implement things at two places at once. However, Zig not only copied C++'s multi-inheritance, but also its header files, without understanding the actual reason why it existed in the first place.
I’ve found working with Rust and Bevy to be quite pleasant. If you’re used to working with ECS, I suggest you at least give it a go.
Rust is as functional as C++ 20 with ranges and views is, which is to say it isn’t. Not sure where you got that impression from, but while it does borrow some ideas from functional languages, it’s still very much a procedural one.
Zig doesn’t have headers, nor inheritance. Again, not sure where you got that from, but Zig is basically a modern C, so there’s no OOP anywhere, let alone multiple inheritance.
As for what to use, I think they’re both viable alternatives. I lean more towards Rust, but that’s just due to familiarity. Odin also looks like a viable option, if you don’t mind a smaller ecosystem.
If you want a garbage collected language, then I’d go for C#. Despite its historic reputation as a Windows only language, its been cross platform and open source for roughly a decade at this point. I find it great to work with.
Issue with C# is, that it’s quite far away from a system language, and I would have to write the engine’s main core in some more system-level language, and I don’t consider it good practice to write every component that doesn’t directly interfacing with the OS in a trendy scripting language.
The fact that it can be used as a scripting language doesn’t mean it’s a scripting language. You could use C++ as a scripting language as well, but it would suck.
C# even supports native compilation nowadays, not just JIT, so it’s definitely not a lowly scripting language.
Anyways you’ve got options. Go may also be one of them if you want GC, I forgot to mention it.
But there are no header files in Zig, it just imports zig files as modules.
This AI hallucinations are to the roof. There is no header files, no inheritance at all, header files were not created for that reason.
Holy shit, how wrong can this post be in so few words…
Okay, I likely have mixed it up with another language, which sounded similar…
Huh? Header files should only have declarations, unless you’re screwing around with templates.
Yes, I’ve meant declarations, which makes stuff much harder. There are tools that automatically writes you the header files, but it was a major PIA when I learned C++.
He may have used the wrong word, but maintaining the same function signature across two files (while made easier by IDE tools) sucks ass to do. It was one of the major pain points for me doing a C++ course (along with the abyssmal compilation error messages). Not that I have tried Zig, but I do not see a reason to involve header files in my life if I can avoid it.