3,226 karma · joined Jun 14, 2019 (7y ago) · 4,043 submissions
comment 5y ago · link · parent
a) probably the least important class of bugs for this sort of thing
b) adequately solved with the existing C++ language features anyways.
So what would be the point of rewriting in Rust?
(Assume the people writing it aready have the C++ knowledge and tooling ready.)
comment 5y ago · link · parent
a) 'Simula style' isn't at all like the Smalltalk-derived programming patterns we call 'OOP'. (Simula was about actor-oriented programming anyways, hence the name.)
b) The unique differentiator for C++ was the STL, and not the OOP features that were done better and cleaner in other languages.
c) The killer feature for early C++ adoption was operator overloading, not inheritance. (Pretty much nobody liked using inheritance in C++ even back in the day.)
comment 5y ago · link · parent
The OO features were added because at the time it was the raging fad and people thought that every language simply must have "OOP".
But "OOP" was never a foundational principle for C++, more like a tacked-on sidecar.
comment 5y ago · link · parent
C++ doesn't compete with Java or Go, C++ competes in the "polymorphism via static typing" niche along with Haskell, Ocaml, etc.
If you look at what Haskell at al. need to do to get static polymorphism right then C++ doesn't look at all that complex or strange.
> Dude, C++ can still compile C code, right?
No, wrong.
> And how are C++ templates anything like Haskell or OCaml?
C++ templates are a purely functional Lisp-like DSL.
> Aren't they just some fancy text-based code generator thing, at the end of the day?
So is Haskell.
> I'm really curious about this as everything I've seen so far contradicts your perspective.
You just don't know C++. People think they do because they learned a bit of C back in college, but they don't.
> Or are you talking just about modern C++ (post C++ 11)?
C++11 was a decade ago; hardly "modern".
> That doesn't work as C++ of all kinds is out there in the wild and you'll run into it, at least from external dependencies.
There's lots of legacy crap out there in the wild, including legacy COBOL and legacy Haskell. I fail to see your point; "modern" C++ isn't some wild departure from the original idea of C++. Ever since STL it has been in a pretty specific and well-defined trajectory.
comment 5y ago · link · parent
C++ is much closer to something like OCaml than to C or Java.
The "complexity" is not accidental, and it only seems complex because people are not used to languages with static typing systems. C++ is not complex if you mastered something like the Haskell type system.
(C and Java aren't really statically typed; they rely on run-time typing for polymorphism.)
comment 5y ago · link · parent
There's no way you're going to put this genie back into the bottle, Covid is already endemic.
What should have been done instead is to figure out what factors cause Covid complications, because for the vast majority of people Covid is harmless. One year in and we still haven't even started...
(We spent so much time and effort on vaccines instead, even though there are several strains of Covid in the wild and people routinely get it twice...)
comment 5y ago · link · parent
a) Age is just a confounding variable. Covid seems to be a "cardiovascular" viral disease rather than a "respiratory" one. For the vast majority of people Covid is unpleasant but not at all dangerous. Figuring out the real factors that make Covid dangerous should have been top priority, but unfortunately it isn't.
b) Flu and "common cold" is, in fact, very dangerous and deadly. We just classify those deaths differently, e.g., as deaths from stroke even though strokes can be caused directly by the "common cold".
comment 5y ago · link · parent
Eventually we'll just figure out prophylactic measures for those groups most at risk and leave it at that. It's what we do already with the "common cold", even though the cold can be very dangerous and deadly to some people.
comment 5y ago · link · parent
Probably because they forgot to enable realtime priority for threads in the synchronous frameworks.
Failing to do that means Linux will starve your web request handling threads in favor of various system tasks you don't care about.
comment 5y ago · link · parent
(E.g., don't switch to the systemd or sshd thread if a customer's web request is timing out.)
That said, doing this right is out of reach of the average programmer, and it's doubtful that the compiler has enough domain-specific knowledge to do this automatically.
"Async" of the Python and node.js fame is yet another thing, a hack to get around their interpreters' inability to use kernel multitasking features because of global locks.
comment 5y ago · link · parent
"Linux thread context switch time" is a meaningless metric, since Linux will switch thread context regardless of what you choose to run on your computer.
Any "async" switches are additional overhead; you don't get to not have kernel preemption just because your Rust thread is now switching contexts "asyncly".
There are benefits to having an additional user-mode scheduling mechanism inside your kernel thread, but saving CPU cycles isn't one of them.