7 ms·
> But why can’t I just quit then? What’s the matter? The matter is, none of the languages, especially the so-called “C++ killers” give any real advantage over C
by arcticbull 3y ago
> But why can’t I just quit then? What’s the matter? The matter is, none of the languages, especially the so-called “C++ killers” give any real advantage over C++ in the modern world. All those new languages are mostly focused on holding a programmer on a leash for their own good.
This, very specifically, is the advantage these languages have over C++.
The benefit isn't the universe of things you can do (they're all Turing complete, you can do anything) - it's what the language stops you from doing. This is the thing the C++ committee never understood or at the very least never appreciated.
- zabzonk 3y agowhy do you think the designers of those new languages know what is good for you?
- kstrauser 3y agoBecause they tell me to stop managing memory by hand, as we have mountains of experiment proof that no one[0] is good at it. [0] I meant what I said.
- zabzonk 3y agoum, modern c++ has for at least the past 10 years advised people not to manually manage memory.
- dekken_ 3y agonot really, RAII/shared_ptrs is still manual memory management, just less footguns
- zabzonk 3y agowell, i would not recommend shared_ptr except under rare circumstances, but i don't see what can be wrong with RAII. in fact, it is the languages thar don't have RAII that have the problems, IMHO.
- lofenfew 3y agoits the same as the tools rust provides you, so if that's true it bodes poorly for the supposed c++ successor.
- andyferris 3y agoOne thing I love about C++ is it (mostly) stops me making type errors, compared to dynamic languages - "compile and it works". Adding type constraints makes programming safer, easier, and results in better compilation. You can add other constraints (e.g. temporal constraints) and get similar benefits, on top of the above.
- ReflectedImage 3y agoIt also means you only get one third of the stuff done. Nothing "compiles and it works". That just means you suck at finding bugs :p
- tored 3y agoSome dynamic languages do have type constraints these days, e.g. PHP.
- dale_glass 3y agoBecause I believe safety critical places like aviation are the ones that actually get things right. You can't pile on every demand on the human in charge and expect improvement. We're just not great at taking every possible detail into account. Doing lots of grunt work all the time reliably is what we have computers for. In my old age, I find the more permissive a language is, the more painful it is to code in long term. Perl is great for simple things, but C++ was a vast improvement because it catches a lot of nonsense that Perl will compile just fine. And debugging is so expensive that eventually writing code fast is near worthless. Whatever you gain you more than pay for in debugging afterwards. C++ unfortunately doesn't go far enough.
- zabzonk 3y agoyes - i switched from C to C++ a long, long time ago (late 1980s) because C++ was so much more strongly typed (i still don't understand why other C programmers have stuck with C). i'm less than convinced with the promises of rust (for e.g.), but have only written trivial programs in it.
- ReflectedImage 3y agoBecause simpler languages are inherently better than more complicated ones.
- zabzonk 3y agowhy? says who? assembler (about as simple as you can get) better than (for e.g.) C?
- steveklabnik 3y agoThey don’t. What they do is create a system where the system protects itself from human error. They don’t know better than me: I agree with what they’re doing. Automatic enforcement of good things, plus an escape hatch for emergencies, is better than no restrictions ever.
- wk_end 3y agoI assume you program in assembly language, then? Can’t trust those structured programming types to know best how to manage your instruction pointer after all. “Functions”, “loops”, “conditionals”, all just fancy words for straitjackets.
- vundercind 3y agoI’d love a demographic study of folks who are really unhappy about languages like Rust and Go specifically because they believe they’re crushing their creative spirit. The “I need MAXIMAL EXPRESSIVENESS at all times! Don’t tell me how to do things!” sort I hesitate to even guess what the findings would look like, but I bet it’d be interesting.
- patrick451 3y agoI agree the results would fascinating. The perception from the other side is that rustaceans crave to be bound in the constrictive swaddling of authoritarianism. Which seems to be born out in both the language itself and the foundation.
- steveklabnik 3y ago“the constrictive swaddling of authoritarianism” is a wild way to describe static analysis.
- Verdex 3y agoI'm pretty much static guarantees to the bone. But I sort of get where the dynamic camp is coming from. With something like python, you need to understand lists, dictionaries, loops, and the call stack. And then you're off to the races. Meanwhile with ocaml you need to understand type theory, type inference, algebraic data types, the module system, maybe row poly, (insert a bunch of other things), and now also algebraic effects. And there's no guarantee that the well formed logic of your domain problem is compatible with the type theory your language is using (although, adt + generics almost always does the job if you take a minute). That being said, the way that's being expressed here does leave something to be desired. Like, if someone doesn't jive well with static techniques that's one thing. But I've never really understood decrying people who get it as suffering from some sort of Stockholm syndrome.
- keybored 3y agoLanguage implementers ought to know better than me (the user) about programming language semantics, in this case specifically things like memory safety.
- mgaunard 3y agoMemory safety is a very small fraction of the problems a computer program can have, and replacing them by an immediate shutdown is hardly a very useful improvement on program quality.
- sophacles 3y ago> Memory safety is a very small fraction of the problems a computer program can have And a large fraction of the problems that lead to security situations. Worse, they are often so subtle that they stay in a codebase for decades. > and replacing them by an immediate shutdown is hardly a very useful improvement on program quality. That's a pretty absolutist statement about something that's very context dependent.
- UncleMeat 3y ago"Software quality", in my mind, includes "nobody can send me a crafted text message that gives them remote root access on my phone." Yes, there are security issues beyond memory safety bugs. But these are the issues that are most regularly turned into the most serious exploits and they are hellishly common. All systems security is about layered defenses. "Oh, log4j exists" is not a compelling reason to avoid changes that can mitigate very large portions of security risk. There are places where you'll truly never encounter untrusted input and a crash is just as bad as blasting off and performing whatever unexpected computation, but that's nowhere near the entire existing C++ landscape.
- mgaunard 3y agoDesign by contract improves software quality instead of lowering it. And it explicitly introduces undefined behaviour aka "memory safety bugs".
- stavros 3y agoThis is a bit of a misnomer, languages don't generally stop you from doing things. They just make really damn sure that you aren't doing it by accident.
- deleted 3y ago[deleted]
- Brian_K_White 3y agowhat do you think those new languages prevent you from doing?
- UncleMeat 3y agoIs a bounds check on every container access good for me? Not always. Sometimes my code is correct. But security vulnerabilities are observably a huge problem. And you only need one vuln in iMessage or whatever to get a dissident journalist's phone hacked and then get them murdered by the Saudi government. Is "I know what I'm doing, I promise" good enough for you in that case? I find it interesting because until about three years ago, C++ was always on the other side of this argument. We fight about static type systems. You could shout at the compiler that you know that your code is correct even though the type system doesn't pass. Why does the committee think it knows better than me! Everything is just bits after all! Now we are on the other side. C++ people saying "bro I totally promise I'll initialize this data member before it is used, stop making me initialize it in my constructor"
- zabzonk 3y ago> Now we are on the other side. C++ people saying "bro I totally promise I'll initialize this data member before it is used, stop making me initialize it in my constructor" C++ has never said this - if a type has a constructor, that constructor will always be used in a data member (or elsewhere).
- UncleMeat 3y ago??? You can absolutely write a type like this. class Foo { public: Foo() {} // never initialized x int x; } And then using it like this Foo f; bar(foo.x); // oops "But my types are well designed" is the usual response to "why the heck does the language allow you to quietly expose yourself to UB in this way?"
- munificent 3y agozabzonk said "if a type has a constructor", but I don't think the int type does, which is why you get uninitialized memory here. Any instance of Foo will run Foo's constructor because Foo has one. The problem is that that instance of Foo won't definitely have x initialized, because int doesn't.
- munificent 3y agoThis is such a silly send-up. They don't know what's good for me. They tell me what their language is good for. I decide if what the language is good for is good for me.
- Verdex 3y agoThis is the key insight. I think that the reason why we have so many c++ replacement languages is because c++ is okayish for basically anything. Replacing it completely will necessitate several different languages that are good for different applications. Okayish was fine or even necessary in the past but the industry has matured to the point where we need more purpose built tools for more specific projects. Rust is going to be necessary but also zig, hylo, vale, p, Odin, and jai (assuming we ever get a release date). A language able to do everything that c++ can is almost definitely only able to do it all okayish.
- vundercind 3y agoHow could they know that? They might know how to design a language such that it tends to produce exceptionally readable codebases, good performance, and improved safety, though. Maybe not all three at once, but some mix of those that’s better than existing languages, perhaps.
- stouset 3y agoThe same reason we all use structured programming instead of goto.
- deleted 3y ago[deleted]
- deleted 3y ago[deleted]
- scrubs 3y agoIf Austin Powers was a programmer: On a leash? What? ... [if only I could work in a] consequence-free environment, I'll be sound as a pound!
- spease 3y agoIn other words, the “feature” those languages have is reducing the cognitive complexity and more tightly bounding the risk. Newer languages are adding friction or dropping altogether things that you rarely or never want to do, to more tightly constrain the space of possible actions to the set of desired actions.
- Log_out_ 3y agoso experienced cc devs dont need it and the dream is mostly about creating experienced devs who write fast software damage limited by the guardrails of the environment? so its basically the c#\java world of cheap oo software crawling over moores plateau hopping for one more silver bullet that will fix lowcost development,trying to solve the expensive quality dev shortage once more by cheapening out.
- Shawnj2 3y agoAt least in aerospace we use C++ because we need a bare metal language and C++ is the most full featured/widely used one. Rust is great but toolchain support just isn’t there yet and ADA/Spark aren’t widely used anymore for new development.