4 ms·
When I use C++ (for personal projects), it tends to be because of the libraries I want to use (eg EnTT[1] or Immer[2], both of which use templates so can't be e
by dkersten 6y ago
When I use C++ (for personal projects), it tends to be because of the libraries I want to use (eg EnTT[1] or Immer[2], both of which use templates so can't be easily used from other languages). Eventually something like Rust or D may have equivalents to all the libraries I want and I could use those for such projects instead, but for now, if I want to use those things, I need to use C++.
You may also want to look at this talk: "What C++ got Right" [3], where the guy shows some nice things that C++ does that other languages don't. The other languages versions of the code he shows does tend to be simpler and nicer, but the C++ versions tend to give you more control. Some people value that control (rightly or wrongly) and other languages that don't provide it will never feel right to them.
I do personally quite like Rust and I'm eagerly watching Zig and some of the other new contenders, so I'm all for moving to something more pleasant than C++, but modern C++ gives just enough new niceness that I don't feel pushed to jump ship until the alternatives check more boxes.
[1] https://github.com/skypjack/entt https://github.com/skypjack/entt
[2] https://github.com/arximboldi/immer https://github.com/arximboldi/immer
[3] https://www.youtube.com/watch?v=bMSrNBcir4Y&t=1757s https://www.youtube.com/watch?v=bMSrNBcir4Y&t=1757s
- suby 6y agoI'm not replying to detract from your point, because I agree with you whole heartedly that competing ecosystems are not mature enough to dethrown C++ if you're someone who is pragmatic and wants to get things done. C++ has an enormous number of high quality libraries with often no equivalents in competing languages. There are some compelling ECS frameworks emerging in Rust if anyone is interested, though. Legion -- https://github.com/amethyst/legion https://github.com/amethyst/legion Hecs -- https://github.com/Ralith/hecs https://github.com/Ralith/hecs Shipyard -- https://github.com/leudz/shipyard https://github.com/leudz/shipyard Specs -- https://github.com/amethyst/specs https://github.com/amethyst/specs Bevy -- https://github.com/bevyengine/bevy https://github.com/bevyengine/bevy -- not strictly comparable as it's an entire game engine, but it's built around an (imo) more ergonomic fork of hecs. Some benchmarks -- https://github.com/rust-gamedev/ecs_bench_suite https://github.com/rust-gamedev/ecs_bench_suite
- dkersten 6y agoThere are some great ECS frameworks for a lot of languages these days, but in my personal opinion (rightly or wrongly), EnTT is in a league of its own in terms of features and performance, its very mature, constantly improved, and, possibly the most important part, I have experience using it.
- socialdemocrat 6y agoThe logic seems a bit circular to me. I cannot imagine you would have even discovered those libraries if not for the fact that you specifically wanted to use C++ libraries. Neither game engines nor immutable data structures is anything special about C++. You could have used Godot, Unity3D and a whole host of other game engines if you wanted to make a game. If immutable data structures is your thing, wouldn't a functional language be a better fit, such as Haskell? But I do know the problem you talk about. I have mostly used C++ in the past because you could not get any good GUI libraries in other languages. I have played around with Zig a bit. Tried Rust earlier, but it seems to me to duplicate many of the things I didn't like about C++: slow compile times, complexity, verbose syntax. Zig I am still making up my mind about. It looks to be on the right track. But for now I think Swift and Go are pretty good alternatives to C++, a bit depending on what you are making. Personally I prefer Julia, but that is not exactly a drop in replacement for C++. You don't get fine grained control over memory usage and it is not suited for real time systems or small memory footprint. Zig is great at all those things though. Julia does replace C++ however in most case where you simply need raw number crunching performance, such as simulations, scientific computing, machine learning etc.