31 points · by ProgC · 12y ago · 36 comments
The Linux kernel, which is entirely written in C, is a fine example of object-oriented programming. File descriptors are object references. The filesystem is a beautiful heirarchy of polymorphic nodes. There simply is no non-OOP way to implement these things.
* I cannot mention singletons without linking this essay of mine, even though I'm somewhat embarrassed that I never found time to fill in the rest of the site: http://www.object-oriented-security.org/lets-argue/singleton...
Yes there is. You can implement them as an endofunctor.
Depending on your specific definition of OOP.
I suspect what the author is talking about is the high level of coupling that occurred in a looooot of 90's/early 2000's codebases. It was a time of learning for many many people, but our industry as a whole, and the C++ community specifically, has learned a lot from those mistakes.
- Angelo from c0de517e
Dependency injection is the name of the game right? That's what videos on youtube are advocating...
But it's also a pain to pass everything that is needed down to functions, so let's stuff all the global state in a class and pass that class down!
I hope I just didn't get the sarcasm, really.
The environment pattern effectively makes this context implicit.
Tl;dr: D: kinda cool, not enough though. Rust: kinda cool, not enough though. golang: kinda cool, not enough though.
Also how is D '''not a "high-performance" language'''?
D is not high-performance (I clarified that in the post) the same way as C and C++ are not. They are not meant for HPC, they are meant to be "systems" languages.
The difference between the two is that HPC is usually about parallelism and has always been. Instruction level (SIMD and GPUs), threads, clusters and so on. D is a bit better than C++ as it at least standardizes SIMD a bit, but still IMHO it doesn't qualify as HPC.
C++ adopted threads only in 11, doesn't have SIMD, doesn't know about GPUs, it got "restrict" only in 11 as well and so on and on. It's clearly not for HPC.
> C++ adopted threads only in 11
Fair.
> doesn't know about GPUs,
Is there a general purpose language that has GPU support out of the box?
> it got "restrict" only in 11 as well
AFAIK, restrict is still not part of the standard, despite compilers implementing it.
Ultimately, I think he's right: what we need is to be able to invent and use high-level languages and DSL's that are wonderfully expressive for our domain (with fast iteration and all that), but also to be able to control the low-level run-time code that gets executed as a result, so it can be fast and efficient.
That's the holy grail as I see it. And LLVM is a key contender to provide the backend of that vision. (TFA talks about a lot of other things, but this is pretty much how I interpreted its conclusion, and I agree).
I then wonder how long it will be before they get upset about some feature they consider to be inelegant and try to find the next fad or old language they had previously discarded.
I really wish people would stop doing this. They like to tear down, without really building anything! It's sort of a whinge to tear things down without really understanding why certain concepts or ideas were invented. Kind of lame.
It's quite possible not only to offer a complete C++ replacement but to also substantially improve on C++ on all aspects.
Probably the strongest point of C++, besides its performance, is its ability to interact with C easily and efficiently.
A huge amount of C++'s complexity comes from this requirement, but the benefits are enormous. It's such a big deal that MS eventually just started recommending people use C++/CLI to interop with C instead of using the usual C# Interop methods.
Too many people underestimate the extreme advantages that are still gotten today by that requirement.
The rest of it, yes, you could, but not that specific requirement. Doing that efficiently and easily enforces certain restrictions on the language, and the underlying runtime.