5 ms·
Interesting article. So, more confirmation C++ is inferior for writing predictable or high performance applications. I actually see an opportunity for a C-compa
by nickpsecurity 12y ago
Interesting article. So, more confirmation C++ is inferior for writing predictable or high performance applications. I actually see an opportunity for a C-compatible or C-competitive systems language here to beat C++ at its own game. Zero-cost abstractions plus solving C++'s specific problems, painless C FFI, and compilation to C (or LLVM) to leverage their compilers. Might make a nice combo. I doubt we'll see much takeup, though, as the technical merits rarely dictate that.
On a related note, I'd like to see the results of it being coded in a modern Ada or SPARK with one of the best compilers. I'd be interested in seeing it with full runtime checks on and off with conservative optimization. ZeroMQ with strong implementation assurance could lay the foundation for all kinds of secure networking and middleware schemes. Heck, I'd like to see a team formally verify a version of it with an executable for common architectures. I'd have fun with that. :)
- voidlogic 12y ago>I actually see an opportunity for a C-compatible or C-competitive systems language here to beat C++ at its own game. Go or Rust? They might not quite match your dream outlined above, but I think in practice they are pretty much used with the purpose of achieving something similar. They both can be "unsafe" as needed and integrate well with C and ASM.
- marktangotango 12y agoVala gets no love in these discussions; a C# subset that compiles to C and gobject.
- gue5t 12y agoVala is not a C# subset (though it does significantly resemble C#) and really isn't intended or suitable for writing high-performance code or reusable low-level libraries like C or C++ are; it's a way to write GObject-style C without as much boilerplate as it takes in C. For that niche it's quite nice, and helps avoid refcounting errors which can be very subtle in C, but Vala is still a fairly leaky abstraction over the C to which it compiles.
- nickpsecurity 12y agoCurrently, Go makes some decisions that hurt it for high performance systems, bare metal, and so on. Rust barely survived some beginner OS projects without its bloat and performance problems showing up. Once comparison I read showed Rust's compiler caught many bugs that slipped through Go's due to Rust design choices. I'm pulling for Rust in particular because its team made clever, design choices for their safety-vs-performance&control tradeoffs. Yet, right now, both are inferior to C, C++, Ada, the old Modulas, and even Fortran for bare metal applications. So, it's not a dream so much as me wanting to see an excellent middleware implemented in a language proven for decades to do what the two you referenced hope to do someday. Using proven methods, even if ugly or unpopular, is just what engineers do when solving new problems. I'd happily use the same thing built in Rust (not Go as it's less safe) if they can get it more compact and fast. Meanwhile, I have to use C++ and C implementations because that's what's available.
- voidlogic 12y ago>Currently, Go makes some decisions that hurt it for high performance systems, bare metal, and so on. Can you expand on this? I have had no issue getting to C levels of performance by using "unsafe" or ASM a few small critical sections as needed (tight bodies of inner loops, etc or mmap based allocation).
- nickpsecurity 12y agoGoing from what people on different projects and forums said when I was Googling it. I could assess its current state better with a few questions. Can it run in kernel mode on bare metal? Can it run without a sizeable runtime? Are its core abstractions for common uses (arrays, strings, etc) at C++ performance at least? Are basic, demo algorithms small enough as object code to fit into a L1 cache? These would be a nice start on assessing it as a true C++ alternative for varieties of systems programming. Come to think of it, I might also look to see if any C++ developers in high-end gaming have tried it. They're so tight on efficiency (and skilled at getting it) that might tell me plenty.
- neverartful 12y agoObjective-C: "You messaged?" I believe that Objective C is a pretty good (yes, it's getting old) combination of C compatibility with object oriented features as well. The 2 big downsides IMO are: (1) essentially restricted to Apple ecosystem and (2) the syntax keeps a lot of developers away.
- QuercusMax 12y agoI agree strongly; I never really mastered C++, but I've done lots of Java development and enough C developments in anger to consider myself at least a journeyman C developer. (I know enough C++ to be dangerous.) The message-passing syntax is such a funny thing to me; it looks weird, but it takes about 1 minute to grok if you try, and then the rest is very simple. It's really dynamic and lets you do some very powerful things that you wouldn't expect to be able to do in a C-derived language (NSProxy, respondsToSelector:, etc.). I find it very natural when doing ObjC development to write all my high-level code is very "objecty" style, and then call into pure C methods when I'm doing something tricky/low-level/fiddly. On the downside, though, mostly due to it being old and not very well adopted, ObjC never got a proper generics system, which is really annoying if you're used to Java or C++.
- nickpsecurity 12y agoMy quick perusal of online links show that Objective-C is slower than C++, maybe due to its dynamic typing. It has the C compatibility and basic OOP. Yet, my idea was a language like this which is faster than C++. Maybe a statically typed version of Objective-C would do?
- neverartful 12y agoThe OO parts of Objective-C will likely be slower than the OO parts of C++ in many cases. There are a few places where ObjC can help even the score on performance. Typically ObjC objects are not copied (cloned). Normal usage (within a collection, ivars, etc.) is with reference counting. Prior to C++11 (shared_ptr, unique_ptr, etc.), there wasn't a good way within the language itself to track object ownership without having to make object copies. Since C++ and ObjC are both (essentially) supersets of C, you can always mix however much (or little) of plain C that you want. Everything about OO in ObjC is very dynamic. It allows you to do some very cool/flexible/unsafe/unwise things. In my opinion, that where the tradeoffs start showing up. Flexibility, runtime speed, nice abstractions, development speed, code complexity, etc. Really difficult, if not impossible, to have them all at once. Despite the unusual looking OO syntax of ObjC, overall it's a pretty simple language given the power it provides. Once you get acclimated to looking at its syntax, I'll even dare say that it's much easier to read and understand than many other languages.
- kragen 12y agoIs this a sort of informal RFQ? What's your budget?
- nickpsecurity 12y agoThere's no shortage of people taking a stab at language design and even resources to pull it off. The post was intended to provide a simple route for making (a) a better C++ or (b) a ZeroMQ variant with improved robustness & maintenance. Just inspiration and stuff to think about. If I had a budget, a few companies that can get the job done would already have the contract.
- kragen 12y agoOh, I think I see — you're generously sharing your language-design expertise by guiding us towards working on things whose potential you can see, potential that a less experienced or talented person might miss?
- nickpsecurity 11y agoClose, but that's an elitist attitude. More like I help things along by sharing lessons learned from thousands of academic papers, industrial case studies, and so on that I've read. Our industry has a problem where it continuously forgets past accomplishments and solutions. An example is the "can an OS be written in a managed language?" question that keeps popping up despite it being done a half-dozen times. Or endless tactics to avoid stack-smashing while MULTICS's reverse stack solved the root problem in early 70's. Can we scale linearly to thousands of nodes with strong consistency? NonStop and some MPP's did that in the 80's while publishing how. So, it's not that people are stupid or inferior to me. They've just put more of their time in other things (eg work, coding) rather than digging out gems stored behind paywalls or published in obscure places. I've been digging for years along with R&D on much of it. I share that stuff where it might help and it's helped many people/companies in the past. So, I keep doing it. People are free to ignore any suggestions. About 99.999% do.
- girvo 12y agoWhile it's not a C-like language, Nim [0] is an interesting take on how to do a "systems" language, with a very interesting GC story (and a way to turn it off altogether or manually manage memory when required) and amazing C FFI -- I'm not much of a C programmer, but even I've managed to integrate C libraries into Nim. Still not quite what you're after though; I think more something like Go, with manual memory management would be nicer. A "modern C", that takes learnings from C++'s successes and failures, but keeps C's strengths. Rust [1], basically! [0] http://nim-lang.org/ http://nim-lang.org/ [1] http://www.rust-lang.org/ http://www.rust-lang.org/
- nickpsecurity 12y agoI saw it a while back and thought "another toy language that won't deliver." Reading the FAQ, the author quoted as inspiration every alternative language I mentioned in this thread lol. He's done his homework. And the features and compatibility have gotten quite impressive since first release... likely due to him using it to build itself (productivity advantage). And under a MIT license. I appreciate you bringing it back to my attention. It's worth someone evaluating thoroughly against C and C++ for systems programming (incl OS) in terms of performance and maintenance. Not sure if I can squeeze time in but I'll suggest that to others at least.
- Shorel 12y agoD. It exists already, only needs more libraries and more users. Yes, they are removing the GC dependency from the standard library.
- TwoBit 12y agoNope. The author was just clueless.