14 ms·
C++ has already got to a point the teams inside my company can't even talk between themselves properly (it's R&D and very heterogeneous, so not that bad) but th
by spyremeown 5y ago
C++ has already got to a point the teams inside my company can't even talk between themselves properly (it's R&D and very heterogeneous, so not that bad) but this doesn't happen with any other language. It's ridiculous.
The newcomers struggle so much to learn the language, and tbh I just say to them to learn the sane 5% of the language and ignore the rest. It's a monstrosity, extremely hard to bring up and generally not nice to read nor write.
I really wish a good, well-maintained, modern (as in, actually break stupid compatibility, just fuck it. It's 2021 for God sakes) C++ existed.
- andi999 5y agoD tried, but somehow failed.
- zarzavat 5y agoD suffered from too many options, multiple standard libraries and indecision between GC and manual memory management.
- generichuman 5y ago> D suffered from [...] indecision between GC and manual memory management. It is still suffering from that. If you want to manage memory yourself you can't use some parts of the standard library + you can't use a lot of the community packages since they assume there is a GC present. So far it looks like the best alternative is Zig, but sadly it doesn't have some of the higher-level language features such as function overloading, compile-time interfaces (Rust traits) or macros. Jai seems to have most D features and more without the GC [0] but Zig is more likely win popular mindshare since it already is in the open + comes with a C/C++ compiler which is pretty cool. [0] https://github.com/Jai-Community/Jai-Community-Library/wiki https://github.com/Jai-Community/Jai-Community-Library/wiki
- andi999 5y agoExciting. The tutorial says download the compiler, somehow cannot find it, do you have a link?
- generichuman 5y agoJai isn't available to public, sadly. That's why I said Zig is "already in the open". Jai has been in private beta since early 2020 and there are about 150 people that have access to the compiler beta AFAIK. The reason for the language not being available is that the designer (Jonathan Blow) doesn't want to release something half-baked to the world (because "there is already so much garbage software out in the world", or some line of reasoning similar to that). I don't agree with his reasoning, but I understand it TBH. He also has the reputation of taking too long to develop his games, but when they're finally released they're pretty good. Anyway, it doesn't look like it'll be released to the public soon so like I said, Zig is the best alternative right now -- and it's gaining more and more users, so when Jai finally gets released, Zig might have already won.
- cyber_kinetist 5y agoJai and Zig are my next two bets (after exploring some Nim and concluding that it needs more time to develop), but Jai has made design decisions that are much more appealing to gamedev, and Zig seems less pragmatic in this regard. Both seem to be promising languages in general, I'm only comparing them from a perspective of a specific domain of programming. - Zig doesn't have operator overloading while Jai does. Maybe a minor nitpick compared to the other ones, but this is a must-have for any math-heavy code, even crufty Orthodox C++ practicioners seem to use it. - Jai's dev team is also developing a compiler backend that is much faster than LLVM - it's only for debug builds, but that compile speed is very important for any iteration-based workflow. - Jai's compile time evaluation is far more powerful - it can access the disk/internet and call any libraries. This is probably a horror show for any webdevs who like to do "npm install" without any thought, but in the case of gamedev where you have precise control over your dependencies this gives a much more higher degree of freedom. (For example, with this I imagine not only Jai code replacing all your build system scripts, but also asset management, packaging, localization, and publishing as well.) Jai's compile time evaluation also runs in a custom made bytecode-interpreter, which is probably going to be way faster than interpreting raw LLVM IR (which is what I think Zig's implementation is doing) - Jai's support for switching allocators on the fly seems a bit less elegant than Zig's approach, but for actual usage I imagine it will be a lot ergonomic to use. As you have said, you can't dismiss the community traction of Zig. But for me the most important thing will be: which language will actually ship a (reasonably sized) commercial game first. In that regard, as Jai's release will coincide with the Sokoban game that Blow's making it with, I think Jai will be the next language I try after C++ (well, if it releases though...)
- p0nce 5y agoI much more happy using D that I have ever been using C++. It is a perfect replacement, with none of the issues mentionned in GP comment.
- vanderZwan 5y agoI haven't coded in either¹, but I got the impression that Rust tries to supersede C++, and that Zig tries to supersede C, and that they're both slowly getting there. Is that a bad oversimplification? ¹ nor seriously coded in C++ in a long time, for that matter, so take this statement as an outsider impression
- oleganza 5y agoNot sure about Zig, but Rust is a pretty successful replacement for C++ by and for all the people who want low-level efficiency of C/C++ but with safety guarantees and reasonable semantics that can be understood without long and painful training.
- spyremeown 5y agoI really want to take a good look at Rust... it does seem to have very reasonable syntax and cargo looks nice.
- eska 5y agoThe bigger sell to me is that you can actually give safe rust code to a newcomer, and they won’t cut themselves on the most basic of tasks. Code review and work delegation have become soooo much easier for me as software dev lead.
- pjmlp 5y agoIt is a successful language, a successful C++ replacement remains to be seen, as per companies whose SDKs favour only C, C++ and their managed stacks.
- flooow 5y agoDo people really think Rust isn't a replacement for C? For the work I do - optimisation algorithms that must run As Fast As Possible - it absolutely is a much-superior replacement for C. I think what people mean is that Rust violates their perception of what C 'is' - 'simple, bare-metal, low-abstraction'. Well I don't think C is any of these things and Rust's memory model (borrow-checker) is a much more explicit and precise representation of the actual (implicit, undocumented) invariants of your C program. In that sense it is 'simpler'.
- kubb 5y agoI thought Rust was that better C++. It doesn't help existing large projects because nobody will ever rewrite them. However, if you're starting a C++ project in 2021 and have the option of using Rust, you might want to think twice.
- tialaramex 5y agoThere certainly are C++ programmers who express this sentiment. e.g. https://www.thecodedmessage.com/posts/hello-rust/ https://www.thecodedmessage.com/posts/hello-rust/ On the other hand, if the thing you don't like about C++ is that it keeps changing you may be unsatisfied in Rust too because Rust has in some ways an even faster pace of changes. Rust as it was written in 2015 still compiles on a modern Rust compiler (with edition set to "2015" and modulo any security issues) but it is no longer idiomatic Rust.
- kubb 5y agoI think the OP is not complaining about change. Arguably, change is inevitable. He seems to dislike trying to keep backwards compatibility at the cost of sanity and usability, and the fact that C++ is an ever-growing pile of features that doesn't make sense anymore. This is precisely what the Rust edition are there to solve: your legacy code will work but the language will change with each edition to reflect the state of the art, and if needed, it will break backwards compatibility.
- oconnor663 5y ago> modulo any security issues I'm not sure there are any security issues associated with using an older edition. I think when soundness holes and other things like that are fixed, they're usually fixed across all editions. Sometimes that's technically a backwards-incompatible change/fix, but Rust's back compat policy considers that acceptable if the breakage isn't widespread.
- nicoburns 5y ago> Rust as it was written in 2015 still compiles on a modern Rust compiler... but it is no longer idiomatic Rust. The changes since the 2015 edition have all been relatively minor in terms of idiomatic code I think. I mean sure, you can use the '?' operator instead doing a manual match and return, but most of the changes have just been making the compiler more permissive in terms of what it accepts. The only new concept to be learnt would be async-await, and that should be familiar to most from other languages and only applies if you're doing IO.
- yodsanklai 5y ago> tbh I just say to them to learn the sane 5% of the language and ignore the rest I thought I knew C++ well enough to get by. But in my current company, there's no way you can do anything in the C++ codebase without a serious understanding of the language latest features. Basically, it seems they use all single features available. And it seems some people love this mess.
- kovac 5y agoAnd you can't really have a sane conversation with these guys either. I've never met a more arrogant programming community than the c++. I wanted to learn more low level programming when I was a C# dev, and coming from an OOP background, I chose C++ (also I had encountered c++ in school as a first language) . Man, was it humiliating asking questions even on stack overflow. Apparently everything is obvious and I'm an idiot. In any case, I dropped C++ (not because of the obnoxious community but the language felt so poorly designed, coming from C#) and turned to C. Its been so far an amazing experience learning from C community. They are deeply insightful about computers and genuinely willing to help new engineers. Very experienced and very high calibre c engineers were helping me out without trying to show off how much smarter they are than the rest of the world despite being clearly far better and smarter than I am.
- eska 5y agoThere are a lot of hardware engineers at my company that more or less occasionally use Python or C# to get their job done. I understand that those languages are the better choice for them and gladly help them with getting C bindings done for the odd library in our industry, and to understand some low level concepts such as CPU cache when they run into problems due to those. I turned away from the C++ unity towards the Rust community because I saw the same issue as you, and am very happy about that decision.
- pjmlp 5y agoIt is somehow ironic to read this, given the heat given to newcomers on comp.lang.c and even the moderated one on Usenet.
- 5y ago
- oreally 5y agoThere's some attempts to keep C++ stuff restrained done to a sane level, for example Orthodox C++ https://gist.github.com/bkaradzic/2e39896bc7d8c34e042b https://gist.github.com/bkaradzic/2e39896bc7d8c34e042b. I suggest that you stick to them. And for everyone who feels they have to incorporate the newest features of modern C++, don't. Avoid modern fetishism and make decisions based off things that have survived the Lindy effect.
- m0zg 5y agoIt does exist. It's your regular C++17 with Google Style on top (though perhaps with exceptions allowed), ruthlessly enforced through reviews. For larger teams to talk to each other use Protocol Buffers and GRPC to decouple interfaces. For build use Bazel. For utility code use Abseil. Do not use Boost for anything. For editing, set up Vim/Nvim + YouCompleteMe. With this setup I find C++ pretty easy to work in. And I've built a team of ~50 devs that were productive on the same multiplatform C++ codebase (+ all sorts of language bindings).
- castratikron 5y agoMy only gripe with gRPC is that there is no way to integrate it into a foreign event loop. I'm a big fan of single threaded event driven architecture ( I mostly do embedded work)
- m0zg 5y agoThat is by far not the only gripe I have with gRPC, but yeah, it's not designed for embedded. It's too large and too full featured for that. Maybe there's a cut down variant somewhere though, it is an open standard, it is conceivable that someone could implement a portion of its features compactly. For instance for Protocol Buffers there's c-only nanopb.
- mcguire 5y agoWhat happens when you have to use something that isn't on your list? Do you fire people who don't like Vim?
- m0zg 5y agoThey can figure out how to set up VSCode or CLion. Wrt everything else - tough luck. OP asked for usable subset, I gave them the usable subset, battle tested for 15 years on a multimillion LOC, codebase, quite possibly the largest and most impressive in the world.
- astonex 5y agoThat's what code standards are for, so you're all writing code that everyone can understand. Seems like a failure of the tech managers
- pyjarrett 5y ago> I really wish a good, well-maintained, modern (as in, actually break stupid compatibility, just fuck it. It's 2021 for God sakes) C++ existed. As a C++ programmer I would say this language is Ada 2012 (see https://pyjarrett.github.io/programming-with-ada/four-months-summary.html https://pyjarrett.github.io/programming-with-ada/four-months...). It's hard to get people past the initial shock of the Pascal family syntax, but once you do, you'll find it ludicrously close feature-wise to the base C++ feature set that gets used day-to-day (RAII, templates, etc.) but with a Pascal skin. It also comes with built-in concurrency.
- titzer 5y ago> Pascal family syntax I have fantasies of doing a "new" programming language which is literally a lexical translation of Ada into curly-brace syntax and calling it Curla. I wonder if anyone would notice that it was just Ada!
- pyjarrett 5y agoThis has already been done (http://www.adapplang.com/index.html http://www.adapplang.com/index.html).
- Jtsummers 5y agoWhich is actually an April Fool's Joke. They only bothered to replace begin/end with {/} and is with :. Which results in delightfully asymmetric examples like with case: case Foo: when Bar => ... } The also eliminated the need to both with and use if you use a package (the only positive change suggested on that site), and added some abbreviations like pkg and priv.
- deleted 5y ago[deleted]
- mikewarot 5y ago>It's hard to get people past the initial shock of the Pascal family syntax What's so shocking about Pascal?
- DrBazza 5y agoThe Dave Abrahams comment in the questions here: https://www.youtube.com/watch?v=raB_289NxBk https://www.youtube.com/watch?v=raB_289NxBk "We got a lot of mileage in Swift, saying no to things" and "You're not going to get to a simpler language by adding features". I've taken two comments (I don't feel that they're out of context), and they're 100% correct. As is your comment about learning the 5% part. > I really wish a good, well-maintained, modern (as in, actually break stupid compatibility, just fuck it. It's 2021 for God sakes) C++ existed. I often joke to my colleagues and say that C++42 will be equal to D today, or in fact D from 5 years ago.
- shadedtriangle 5y agoI think the nice language is in there, but it’s buried within the backwards compatibility as you mentioned. I’ve started putting together https://cppbyexample.com https://cppbyexample.com as a way for newcomers to learn because pointing them to a reference or outdated examples isn’t helping anyone.
- physicsguy 5y ago> C++ has already got to a point the teams inside my company can't even talk between themselves properly (it's R&D and very heterogeneous, so not that bad) but this doesn't happen with any other language. It's ridiculous. Yeah, that's totally true. But I would also say that a lot of it in my experience is people not even trying to keep up with the standards and barely even writing C++11 style code. I wouldn't expect to go into a Python shop (my other language) and work with people who hadn't tried to keep up with that language for 10 years but many C++ devs seem to have that attitude.
- CodeGlitch 5y agoHave you looked at Nim? Simple like Python, but generates optimised machine code. It is also statically typed, unlike Python.