Re:The long goodbye to C
by tptacek on Friday November 10, 2017 @11:44AM
(#15671063)
I'm not sure there's really much to learn from this post.
Raymond is not in fact in a good vantage point to judge the suitability of Go or Rust as "systems languages". His claims to authority in this post are "NTPsec" and GPSD†, but Raymond neither designed nor implemented either of those programs: NTPsec is a hostile fork of ntpd, and GPSD --- which is probably not a good example of a program that makes particularly strenuous demands on its programming language runtime --- was maintained by Russell Nelson, after being written by a different team --- before Raymond claimed it for his resume.
In this middle of this article, Raymond claims that Python is suitable largely for single-user applications operating "at human speed". This is so far outside the reality of how Python is used in industry as to call pretty much everything else Raymond writes in the article into question.
Surely, somebody else has to have written something better on the trend towards next-generation systems languages.
† These are the examples he provides, in this article, by the way.
Re:The long goodbye to C
by emodendroket on Friday November 10, 2017 @12:55PM
(#15671615)
Isn't that just his typical MO? It's always seemed to me he was more of a hanger-on looking for glory (or perhaps an essayist and advocate, if we want to be a charitable) than a really significant contributor.
Re:The long goodbye to C
by vancan1ty on Friday November 10, 2017 @09:32PM
(#15674686)
Your post does not address Raymond's arguments, but instead primarily just attacks the messenger as supposedly not being qualified to comment on language trends.
While it may be true that ESR is not a superstar programmer in the image of a John Carmack or a Bill Gates, he has been a working C developer for over 30 years, and has contributed to numerous open-source projects, including systems projects, over that period of time. The examples he lists in the article are some pieces of software which he is currently a maintainer for.
Actually I think the fact that he is not a superstar programmer with a signature project possibly makes him a bit more qualified to comment on language trends. After all, most of the developers in the industry are by definition about average, and if average (or even somewhat above average) developers are finding their productivity much higher in Python and Go than they do in C, then they will start doing more work in those languages and less in C. In fact, that transition is exactly what ESR is describing in the article.
Certainly it seems that Go is usable for certain classes of problems that would formerly have been C's domain.
Re:The long goodbye to C
by AstralStorm on Saturday November 11, 2017 @02:41AM
(#15675385)
If by productivity you count the number of programs written, Python is not even close to Java.
I'd by productivity you count time to solution, a lot of applications written in python do not have performance requirements, which makes the comparison very unfair.
Re:The long goodbye to C
by dreamcompiler on Friday November 10, 2017 @12:45PM
(#15671527)
> Raymond claims that Python is suitable largely for single-user applications operating "at human speed". This is so far outside the reality of how Python is used in industry as to call pretty much everything else Raymond writes in the article into question.
Could you elaborate? Are you talking about e.g. numpy and scipy? Python is good at calling C libraries but that doesn't make it good for writing an IP stack or a device driver or an OS. Are you arguing against the "single-user" point or the "human speed" point?
Re:The long goodbye to C
by tptacek on Friday November 10, 2017 @01:49PM
(#15671979)
He didn't say "Python doesn't work well for IP stacks" (although: for special-purpose userspace IP stacks, people have done it). He said "Python only works for single-user human-speed use cases". Which, obviously, ignores the fact that every 3rd west coast SaaS tech company has Python at the core of their stack.
Re:The long goodbye to C
by Nokinside on Friday November 10, 2017 @01:43PM
(#15671945)
I predict that C++ will lose more ground to Rust and Go than C.
It's hard to find programming language that will cover as much low level programming needs as C. If some aspiring hacker turns 14 today and wants to get into the low level systems programming/embedded programmer career learning C well is a must. They may use some other language more, but they need to know C unless they want to limit themselves.
Some processors have stack size just 2-8 and memory available can be something like 128B - 8KB. Any replacement must have programing model that is very low level. Any replacement for C must have very low level and simple programming model.
Re:The long goodbye to C
by digitalzombie on Friday November 10, 2017 @02:00PM
(#15672066)
Go... isn't really a system programming language. I don't get why people group Rust and Go together.
C++ may lose some ground to Rust but it may just end up saturated like Ruby, PHP did. Ruby is basically in steady state now. NodeJS jump in on a crowded market and got no where let alone it's crazy threadless model.
C++ btw have been pumping out new versions, C++17 was just completed by GCC and Clang is almost done. C++ is really trying to modernize.
Google whole backend is most likely C++... it ain't going no where.
Rust is a beautiful language but it still have a long way to go. And also resources such as books to help people jump on board not just general books either but books in different domain (scientific computing, data structure, web dev, etc.. whatever).
Re:The long goodbye to C
by emodendroket on Friday November 10, 2017 @02:29PM
(#15672282)
Plenty of people are working in node, for whatever reason. Just yesterday I was reading someone on HN saying backend JavaScript is the only way to make any money. Not that I think he's right, but if there are people out there thinking that I figure it has to have healthy enough marketshare.
Re:The long goodbye to C
by vram22 on Friday November 10, 2017 @04:57PM
(#15673388)
How about FreePascal?
I haven't used it for very low level work, more for things like command line utilities (and with Lazarus for some light GUI app work). But the EXE/binary sizes are fairly small (without any optimization or stripping or compression). Also had used Turbo Pascal heavily much earlier. And I've read that Pascal at one time was used for systems programming; Apple may have been one company that used it (much earlier), and that their OS APIs were in Pascal. Windows API's (in Win32 at least) also may have had (not sure) some support for Pascal, viz. keywords like "long far pascal" in Win32 API code.
Side note: I wonder how many people use those abbreviations like viz. these days.
Re:The long goodbye to C
by Rusky on Friday November 10, 2017 @04:59PM
(#15673410)
In some ways, Rust fits that sort of ultra-tiny niche even better than C++. It doesn't have the POD/non-POD split that C++ has, it has a lot of built-in data layout optimizations, idiomatic code does far less copying, you can package up platform hardware definitions in crates, etc.
Of course C++ can just revert to being mostly C in these cases, and C is lightyears ahead in tooling and documentation here, but as a language I think Rust has a decent shot at that space.
Re:The long goodbye to C
by steveklabnik on Saturday November 11, 2017 @08:32AM
(#15676291)
C++'s Core Guidelines have been worked on for the last two years, and weren't even trying to get full compatibility with Rust's guarantees, and still aren't really done yet. It's great work, but it's far from "trivial". If it were trivial to turn C++ into Rust, we wouldn't have bothered making Rust.
Re:The long goodbye to C
by Rusky on Saturday November 11, 2017 @12:14PM
(#15677112)
That's... not true at all. Even aside from the memory safety stuff steveklabnik mentioned in a sibling comment, C++ is struggling to get things like concepts, pattern matching, or modules, and had to do a lot of non-trivial work in the past to get things like move semantics.
And even then none of that solves the problems I mentioned in the comment you replied to.
Re:The long goodbye to C
by fhood on Friday November 10, 2017 @11:33AM
(#15670996)
Oddly enough C never bothered me. It has its purpose, and despite its flaws it still feels elegant. C++ however should be illegal. When do we get to say goodbye to it?
Edit/Continuation: I feel like the freedom offered by C works because of it's simplicity, and as a language for embedded systems I still enjoy developing in C. As someone who recently started working primarily in C++ though I am frequently astounded by the choices that were made. And to make things worse, offering C style controllability in a complex OO language doesn't work well. I shouldn't have to feel like I need to read the designers minds to predict how a language will act.
Re:The long goodbye to C
by rwbt on Friday November 10, 2017 @11:54AM
(#15671142)
After programming in C++ for nearly a decade, I too came to the same conclusion. I was always told to avoid C (because dangling pointers and what not) but now even though C++ has some things I like, overall I think C is a lot easier to 'think' in. Even though dangling pointers etc are an issue, you'll pick up good habits over time and avoid many usual C issues.
I think what replaces C should be something like Nim, which compiles to C and also has great C interop. C++ is definitely not it.
Re:The long goodbye to C
by AstralStorm on Saturday November 11, 2017 @02:56AM
(#15675419)
Why do you call it "thinking in C" as opposed to structural code?
So you like thinking in terms of ststically sized arrays? C++ has proper arrays since C++11.
Nobody can help you if you like malloc, but using shared_ptr and unique_ptr gets close enough.
Nothing prevents quitting structural code in C++. Or even functional for that matter. (Though function objects are not quite light yet.)
There are even safe subsets where at most you will get an exception when you try to do something dirty. Easy to enforce.
Certain things like compile time calculation (being enhanced by the moment) do not even reasonably exist in C or for that matter Nim.
The about one gripe with C++ is ABI or rather lack thereof. Three other is the amount of legacy code written in C or outdated dialects of C++.
Re:The long goodbye to C
by Nokinside on Friday November 10, 2017 @02:06PM
(#15672108)
>dangling pointers etc are an issue
In the safety critical programming we use subset of C or (C++) with static code analysis. It's possible to prove that there is no dangling pointers, divisions by zero, floating point exceptions (with assertions), out of bounds array access. It's called verification.
Programming is limited into MISRA C and then it's run trough static code analysis tool like Astree to prove that there is no runtime errors. There are still bugs, but they are not "typical C errors". Waiting for new systems programming candidates to get their toolchain to match the task.
Re:The long goodbye to C
by baybal2 on Friday November 10, 2017 @12:32PM
(#15671435)
>dangling pointers
C has no standard language provided range checks, and pointer security, but the amount of compiler macroses that do the same/coverage tools/runtime security tools/checks provided by compilers is huge.
At least part of "inherent issues" of C that Rust advocates often cite was long solved by these tools long time ago.
They are not a bullet proof solutions to lack of security features in C, but neither are the built in checks of novel languages. The amount of NX breakouts, syscall hijackings, clever tricks around range checks in so called secure languages being demonstrated every year confirms that.
Re:The long goodbye to C
by scroy on Friday November 10, 2017 @02:19PM
(#15672200)
I'm curious about what's fueling your hatred of C++. In my experience it depends heavily on how it's being used. Modern C++ used competently can get you really far, but I don't know how easy it is to find an environment like that these days, considering the amount of garbage code you can find written in it.
I think it is easy to overestimate the importance of a managed language. Having to manage memory yourself is not that big a burden in many applications. In many cases it is a help.
For instance, I had a ETL program I was writing to process 100+ GB files. I pre-allocated all the memory I needed for exactly one row of data and immediately printed out the data when it finished that row (stream style).
The entire program processed 100 GB with lightning speed in less than 1K of memory. Maxing out the performance of the disk.
Best of all, I only had to free my memory at the end. Completely safe. No danger of double freeing and no extra memory allocation at all. Literally a dozen mallocs at the start and a dozen frees at the end.
Could I do that in Go? Sure. Would it have as optimized memory access? Maybe... but probably not. And C my entire program was 200 lines of code and absurdly fast.
Don't get me wrong, I love Go. I write programs in Go often. But for simple apps where the code can fit in a single file nothing can beat C. No bloat, no extra memory operations, and a code optimizer that has been being optimized for 30+ years. Go's code optimizer is not even close yet from what I can tell.
Looking at that benchmark that tiny difference in performance would have have been very magnified in my use case.
Though I will concede that it is possible that while slower it might still max out disk I/O and once the bottleneck isn't RAM or CPU it doesn't much matter what language you use.
Re:The long goodbye to C
by kardianos on Friday November 10, 2017 @12:38PM
(#15671478)
Yes, you can pre-alloc buffers in Go. And if you are reading and writing to disk, SSDs or HDs, the Go runtime isn't going to be your bottleneck. Yes, you can optimize memory access. That's an explicit design goal.
That is something I have not done in Go and is good to know. But I could be wrong on this one, I have no idea how Go buffers are performance optimized but reading a character from a C array is one CPU instruction... it feels intuitive that in Go just the fact the extra layer of abstraction is added on top means it will be more instructions on the CPU.
But that is just a gut, I have not tested it.
Which in my use case would make a big difference over time.
But my intuition also tells me that it would still max out disk access in Go with modern CPUs.
Edit:
I should mention that my use case was to processes as many gigs of files on as cheap an AWS server as possible while maintaining a very strict SLA on how fast processing should be (the data became obsolete in hours and when we tried higher level languages the data was obsolete before a single file could finish). So I was trying to squeeze out as many CPU cycles as possible.
I should also mention that Go didn't even exist yet in a stable state when I did this project.
Re:The long goodbye to C
by stmw on Friday November 10, 2017 @01:25PM
(#15671818)
The real issue is the garbage collector, something that neither C nor Rust have. Automatic memory management (or thoughtful manual memory management) is good. Garbage collection is a problem.
Re:The long goodbye to C
by stmw on Friday November 10, 2017 @10:51PM
(#15674906)
Unfortunately, "presumably" is not good enough for systems programming - you have no idea when it might run, and you might end up with a lot of environment variables attempting to tame its behavior - like the JDK has.
Re:The long goodbye to C
by isaiahg on Friday November 10, 2017 @12:25PM
(#15671381)
Just out of curiosity from someone who started with languages like JavaScript and other languages. But what makes C special for this case? For instance couldn't I achieve the same thing with typed arrays in JavaScript?
Sorry if it's a naive question. My experience with C is limited.
Re:The long goodbye to C
by vvanders on Friday November 10, 2017 @12:39PM
(#15671491)
Nope, the main advantage of C/Rust/D/etc is explicit control of memory allocation and placement.
90% of your program performance is going to be dominated by cache usage(unless you're doing something really dumb). With C you can place things next to each other explicitly so that your prefetcher/etc is automatically pulling in the data you need to the L1 cache.
Any ref'd/GC'd language is going to make that really hard(not impossible, but you have to jump through a million hoops like sun.misc.unsafe in Java).
Look up Data Oriented Design if you're interested in this stuff, Mike Acton does a great job covering it.
Re:The long goodbye to C
by pjmlp on Friday November 10, 2017 @04:45PM
(#15673318)
> Any ref'd/GC'd language is going to make that really hard(
Not true at all.
Oberon, Active Oberon, Component Pascal, Modula-2+, Modula-3, D, System C#, Nim all offer ways to manually control memory outside GC control, just like C and C++.
Glad to provide Modula-3 examples to any C tricks you might want to do, or in D if you prefer something more modern.
Re:The long goodbye to C
by vvanders on Friday November 10, 2017 @05:05PM
(#15673446)
Yet not a single one of those examples is a mainstream language. So when you finish the project and move on to bigger things I've got a codebase that no one can maintain.
Note that I didn't say that it was impossible, just that the ergonomics of GC'd languages don't tend to focus on performance in the ways that languages with explicit memory control do.
Re:The long goodbye to C
by vvanders on Friday November 10, 2017 @06:27PM
(#15673977)
> Most of those languages died due to political reasons and company acquisitions, not because of lack of technical features.
Yet you just talked past my point to give some sort of soliloquy about Modula-3.
It doesn't matter how those languages died, it just matters that they did. The ecosystem and number of people who know how to write a language is almost, if not more important than the language when it comes to shipping software.
Re:The long goodbye to C
by pjmlp on Saturday November 11, 2017 @03:01AM
(#15675436)
No, my point was that these languages have 100% the same ergonomics as C in what concerns explicit memory management, with the additional productivity of having a GC around when those requirements aren't a must.
We should not think of Java when comparing system programming languages with GC against C.
Re:The long goodbye to C
by vvanders on Saturday November 11, 2017 @11:31AM
(#15676952)
Yet you still keep talking past my point(while also nicely moving the goalpost).
Yes, the languages you mention meet all the technical requirements(congrats, here's your 10 internet points) it doesn't matter if I can't find people who know how to write it.
Since you seem to want to avoid talking about anything I raise I don't think it's productive to continue this conversation.
Re:The long goodbye to C
by pjmlp on Saturday November 11, 2017 @01:38PM
(#15677479)
Just because these languages died, doesn't mean we cannot take those lessons into GC languages where you can find people who know how to write it.
For example, all the work with System C# done in Midori has been being applied to C#, with .NET Native, ref returns, local ref variables, value tuples, regions with disabled GC, memory slices, with a few more down the roadmap, like effectively manual memory management presented at OOPSLA 2017.
Or the ongoing @nogc and BetterC improvements in D, Wallmart, EBay, Netflix, Remedy Games among many others, seem to be able to find people that know how to write it.
Re:The long goodbye to C
by justin66 on Friday November 10, 2017 @02:10PM
(#15672139)
Creating a program that is bound by disk performance and indifferent to l1 cache is not necessarily "really dumb." Premature optimization is a real thing.
Re:The long goodbye to C
by btrask on Friday November 10, 2017 @12:37PM
(#15671467)
If you used Node, you would have IIRC around 40MB (edit: 24MB on my system) of memory overhead before your code even started running. If you are CPU-bound, multiply that by the number of cores you want to use.
Re:The long goodbye to C
by moxious on Friday November 10, 2017 @11:34AM
(#15671007)
It's going to be a loooooooooooooooong goodbye. COBOL is still around for what it's worth. The dominant OS (Linux) is written in C. I'd assert that any language used to implement a widely deployed operating system has at least that operating system's lifetime + 20 years, assuming the OS isn't rewritten.
"Re-write Linux in Go" I think would be a massive but classic folly
What does C have to do with Unix? You can write a Unix-like OS in Rust and a Non-Unix like OS in C (or C++[1], like Windows).
It happens to be a trope that C would have died if not for Unix[2], but to the best of my memory of reading programming books of the eighties, C's un-safety was a _feature_, not a bug (I remember Java books were _so_ apologetic that Java didn't have points arithmetic).
In the days before optimizing compilers and slow computers, the ability to write unsafely manipulate arrays was actually useful when one needed speed (and if one wanted to be a "real hacker", one needed to optimize every byte and instruction.) Now it's true that not every program needed that speed, and quite a few would be willing to trade speed for safety, but no "self respecting real programmer" would allow himself to write in _anything_ that wouldn't let him be that "uber-hacker" (sounds familiar? I guess Resume oriented programming is an old problem).
[1]. Before I get the pedants that C++ isn't C, I'd like to remind them that the Windows NT codebase started in the late eighties and early nineties, when C++ _was_ almost like C with classes.
[2]. In reality, quite a few languages took off which were not the same language as their OS (for example, Java, Python, C#). If anything, I'd say it's more important that the compiler vendor be the same company as the OS vendor (see Borland's history), but even that seems like a more modern problem (again, see Borland's history)
Re:The long goodbye to C
by ravingraven on Friday November 10, 2017 @11:34AM
(#15671000)
This showing up next to "LibHTTP: Open Source HTTP Library in C" on the HN front page made me giggle. Someone should start a website a-la bitcoinobituaries for C.
C will be around for as long as everything under the sun has a C compiler. If you ask yourself when was the last time you started a C project, ask yourself when was the last time you wanted to write something truly (truly, including embedded) portable instead and there is your answer.
Re:The long goodbye to C
by loeg on Friday November 10, 2017 @12:26PM
(#15671388)
We can make unix-alikes in non-C languages, so what's the point of "killing" Unix? I don't see why that's a good goal to have or how it furthers the goal of replacing C.
Re:The long goodbye to C
by loeg on Friday November 10, 2017 @05:08PM
(#15673466)
I mean, I proposed a unix-alike written in a safe language as an alternative to OP's proposal, which was to "kill Unix." What would OP replace Unix with? Windows and Mac OS aren't suitable; they're written in C/C++ too. So any solution here must be a green field, from-scratch OS in a "safe" language.
Any operating system written in a non-C language with no C support is going to break all existing C applications. This is inherent to OP's desire to remove all C. For the record: I'm opposed to removing all C.
So why not preserve unix-like shells, filesystems, devices, commands, etc? None of those are tied to language of implementation. Potentially existing unix shell scripts could run safely on a purely non-C system. Sysadmins would carry over some familiarity from existing Unix-alike systems. That has some value.
Unix servers make up 68-98% of the internet, depending on who is measuring. There's a huge body of sysadmins familiar with shell who are not familiar with Powershell.
So that's exactly my point: I don't think we should start from scratch on things like the Unix shell, filesystem hierarchy, devices, etc. People know them. Throwing out systems people already understand for no reason is a huge anti-pattern.
If you think Powershell is superior, port it to Unix and convince Unix sysadmins to use it. I don't think it's going to be very popular.
Re:The long goodbye to C
by emodendroket on Friday November 10, 2017 @05:21PM
(#15673566)
It's always going to be a second class citizen on Unix, so there is little advantage to picking it up (it's available on Linux already). But in fact, for one thing, Powershell makes a lot of concessions to people with experience in both bash and CMD (for instance, ls, wget, and dir are all built-in aliases, you could probably go a while without realizing pipes work differently, etc), and, for another, by the time you're worried about this kind of thing I can't see why you're trying to make a clean break at all.
Once you've learned how it works having an object oriented shell is game changing. Powershell isn't necessarily the ideal implementation but I'm just calling attention to it as an existing, popular example of something better
Re:The long goodbye to C
by bachmeier on Friday November 10, 2017 @11:29AM
(#15670970)
"Am I predicting the imminent extinction of C? No. For the foreseeable future I think it will retain a pretty firm grip on OS kernels and device firmware. There, the old imperative to squeeze out maximum performance even if it means using an unsafe language still has force."
Maybe, but there are projects like D's betterC[1] that are designed to remove that reason to use C as well.
Re:The long goodbye to C
by krylon on Friday November 10, 2017 @05:35PM
(#15673643)
I do not work in embedded systems, so take anything I say with a grain of salt (or more!).
If D became available in all of those embedded platforms, I am sure lots of people would rejoice. Or maybe they would just shrug because they would not know what hit them. But it would be their loss, because D is, in many ways, C++ "done right". Which IMHO is a remarkable achievement.
Either way, I would not hold my breath for C becoming obsolete in the sense of "no one is using it any more".
It is not happy, but for now it is all we've got.
Re:The long goodbye to C
by scruple on Saturday November 11, 2017 @05:42AM
(#15675793)
> I am sure lots of people would rejoice
I'm one of those people and I spent ~6 years in embedded and I still write C today (though it's no longer my primary language). Of my former co-workers, probably 50 people in total across 4 teams, exactly 0 of them were at all interested in any sort of C alternative. I'd wager less than 6 of them even knew what C alternatives were even picking up steam. If it wasn't talked about by folks like Michael Barr or Embedded magazine, they simply wouldn't have any way of finding out.
> Either way, I would not hold my breath for C becoming obsolete
I wouldn't either. Call it the old guard, call them greybeards, it really doesn't matter. They're the ones buying chips from vendors that supply C toolchains and compilers. Until that is addressed, none of this talk matters.
Re:The long goodbye to C
by bachmeier on Friday November 10, 2017 @02:57PM
(#15672458)
IMO the main advantage of betterC is that you can add new code/partially rewrite old code in D and then integrate it into the existing C project. The limitation (as someone else pointed out) is the possible nonexistence of a D compiler for a given platform.
Re:The long goodbye to C
by stmw on Friday November 10, 2017 @01:27PM
(#15671837)
And the issue is mostly the garbage collector, not any other language features or compiler optimization improvements. You just can't have GC in a systems language.
Re:The long goodbye to C
by slavik81 on Friday November 10, 2017 @07:49PM
(#15674336)
I'm not sure I would call it a nice syntax. std::initializer_list was a questionable addition to C++ because its syntax clashes with other forms of initialization. It ends up creating special cases and complicating generic code. They fixed some of its problems in C++14, and we might see more improvements in C++20, but the entire idea of that syntax creating a special object feels like a mistake.
Re:The long goodbye to C
by sytelus on Friday November 10, 2017 @11:58AM
(#15671176)
Go being paddled by industry hot shots doesn't change the facts. A language designed for systems programming must have precise control on everything that goes on. When you are dealing with thousand threads on 100s of cores, every microsecond counts. When you are designing control software for aerial vehicles on embedded devices doing stuff in ISRs, every thing needs to be predictable. No one in their right mind will rely on gc in that kind of systems programming world.
Re:The long goodbye to C
by abiox on Friday November 10, 2017 @12:14PM
(#15671307)
this is a narrow and arbitrary definition of "systems programming". you seem to be describing something closer to hard realtime computing, which is not the same thing.
Re:The long goodbye to C
by abiox on Friday November 10, 2017 @03:49PM
(#15672902)
if you read your link, even the wikipedia article authors do not restrict the notion to hard realtime computing.
it's not really how "everyone" uses it. it's a narrowing that a subset of vocal people have been trying to push, i can only presume for ideological purposes.
Re:The long goodbye to C
by vvanders on Friday November 10, 2017 @12:28PM
(#15671406)
That's one aspect, the other is targets with small(<10mb) footprints where GC falls over spectacularly when you don't have 2x your working set of free memory.
These aren't uncommon targets, the PSP traditionally had 8mb of system memory. Lots of embedded routers and "IoT" things, etc.
Part of this is confused by everyone having a different definition of "System Programming". In my view if there's a target where hardware constrains prevent suitable performance from a language then that language isn't fit to be considered a "System Programming" language.
The only thing that Go lacks in regards to Oberon are a few intrisics in the unsafe package, easily doable in Assembly, just like ANSI C requires on its libc for bare metal programming.
Re:The long goodbye to C
by katastic on Friday November 10, 2017 @12:29PM
(#15671412)
People who are suggesting a GC language for systems programming have literally never tried it. They're just repeating slogans they heard someone else say. Anyone who had wouldn't dare suggest it's easy or a perfect candidate for the job.
I've done it and it's a pain in the ass. Why? Because the GC is _non-deterministic_. On many languages it can fire up at any time, freeze your threads at any time, and take however long it wants to. "But it usually doesn't take that long!" And? AND? The problem is, you've immediately added a blackbox thread attached to all your data. Enjoy having your program segfault in areas that are completely unrelated because the GC didn't run the finalizer till later. Enjoy having to fix a bug that doesn't have a repeatable effect. You're automatically writing multi-threaded code (and all the complexity that entails) even when you have a single-thread.
A GC adds an entire dimension to bug fixing and potential failure points. Every bug, multiplied by every possible interaction with the GC. This is something that systems programming usually cannot afford. You need to be able to prove your code won't crash.
And that's one more thing. Tons of systems code pre-allocates everything for that crash reason. So what problem is GC actually going to solve when everything is already carefully pre-allocated?
It really sounds like people who aren't used to unmanaged languages are simply projecting their fear of the unknown. I use both types on a daily basis, and to me they're just "the right tool for the right job." I would never try to shoehorn the wrong tool into an ill-fitted application just because I like that tool.
Re:The long goodbye to C
by vvanders on Friday November 10, 2017 @12:35PM
(#15671454)
Yup, don't forget the fact that you'll end up doing pooling, free lists and the exact same performance tricks you'd need to do if you managed memory explicitly.
You're adding a ton of incidental complexity for a benefit that you can't take advantage of(programmer productivity) because you don't have the necessary resources to make it happen(large swaths of memory and > 50ms response times).
Instead of appealing to authority, maybe you could link to some actual arguments by these luminaries.
If you're interested in Rob Pike's take on Go, he expressed regret over initially calling Go a systems programming language, because it gave people the impression that it was appropriate for writing operating systems. He prefers to call it a "server writing language" or a "cloud infrastructure language." @6:45 in this panel discussion: https://channel9.msdn.com/Events/Lang-NEXT/Lang-NEXT-2014/Pa...
Re:The long goodbye to C
by oblio on Friday November 10, 2017 @12:17PM
(#15671326)
But was that due to inherent flaws or due to the hype driven industry we are part of? "Look, Rails is so cool and magic and powerful and DHH is so hot", basically.
Re:The long goodbye to C
by Santosh83 on Friday November 10, 2017 @11:52AM
(#15671127)
> Am I predicting the imminent extinction of C? No. For the foreseeable future I think it will retain a pretty firm grip on OS kernels and device firmware. There, the old imperative to squeeze out maximum performance even if it means using an unsafe language still has force.
Rust is well suited for OS code if not for the inertia that most OS devs are experts at C and not so in Rust and compiler support. Those two factors are going to become less important going forward, so Rust (with generous 'unsafe') could replace C in its last stronghold too.
Re:The long goodbye to C
by muricula on Friday November 10, 2017 @12:37PM
(#15671466)
I don’t believe Rust is ready for OS kernels yet. People have written OS kernels but they really stretch the language to do it. For instance, the default heap allocation API panics on failure, which isn’t something I want my kernel to do. There’s work on a new API which doesn’t do this in nightly rust, but they could completely change all that tomorrow.
Additionally, alignment constraints are also really important at that level, but rust doesn’t have a mature way to align structures or arrays.
Re:The long goodbye to C
by steveklabnik on Saturday November 11, 2017 @08:38AM
(#15676320)
When you're writing a kernel in Rust, you aren't using the default heap allocation API; you aren't using the allocation API at all. You could then build any sort of allocation strategy you want. You don't need to wait for the new traits, though of course, using them eventually helps with interoperability.
You're certainly right about "mature way" wrt alignment, but it's something that can be worked around until then.
Re:The long goodbye to C
by tetromino_ on Tuesday November 14, 2017 @04:40PM
(#15699427)
Well, C's default heap allocation API is not suitable for kernel mode either. Compare libc's malloc and the kernel's kmalloc, with the fine-grained control [1] over what kind of allocation to perform.
Re:The long goodbye to C
by chx on Friday November 10, 2017 @12:38PM
(#15671477)
There's another thing slowly but inexorably gaining ground: you need to write concurrent code. From your CPU to your cloud, parallel is the new king, much more than before. Any language where two parallel running pieces of code can alter the same variable is not usable for parallel purposes as debugging becomes a special hell.
Re:The long goodbye to C
by AstralStorm on Friday November 10, 2017 @02:56PM
(#15672450)
The "unsafe" threading has to be available though. Simone primitives like barriers as well.
Otherwise you pay the cost when you really do not need to. Just ask people involved in actual places where microseconds matter, such as real time control or high frequency trading.
Erlang does not provide these primitives enforcing unnecessary copies in a bunch of places.
Re:The long goodbye to C
by clw8 on Friday November 10, 2017 @12:00PM
(#15671202)
I went to a "Public Ivy" about ten years ago and at the time both CE and CS students started with C, CE students sticking with it and CS students moving on to Java. Is this still true for the average public school? Learning C and various Assembly languages and using them to program micros is where everything finally clicked for me. Rust is lovely but I don't ever see it being the CS101 language because of elegant but difficult concepts like lifetimes.
Re:The long goodbye to C
by pjmlp on Saturday November 11, 2017 @05:57AM
(#15675831)
My university back in the mid-90's taught Pascal, C++, Smalltalk, Prolog, x86 and MIPS Assembly, Caml Light, PL/SQL, and started doing Java on last year there.
Those picking up the optional compiler related lectures, also got an overview around Lisp, Algol, Fortran, Concurrent C, Objective-C, ML, Cobol, Oberon, Modula-2.
Nowhere C was taught as such, we were expected to know about it from the C++ lectures.
Re:The long goodbye to C
by loeg on Friday November 10, 2017 @12:27PM
(#15671402)
UW does Java for both CS and CE and has done since the 00's. There was one optional C and unix class while I was there. Also one mandatory "programming languages" class that introduced functional languages and lisp.
You should absolutely checkout D language (dlang.org).
It’s less stringent compared to Rust’s borrow checker, but also has meta programming capabilities of similar power to macroses. The default is GC manged memory like in Go.
However it’s super flexible in that you can go from 100% simple GC-based programming with dynamic arrays and maps to hardcore low-level stuff with manual memory or anything in between (e.g. Ref-Counting as in C++).
Re:The long goodbye to C
by vortico on Friday November 10, 2017 @11:36AM
(#15671012)
C is really great for writing format encoders/decoders that easily bind with any scripting or compiled language in existence. The ease of compiling it on all platforms and producing binaries that export simple "function_name" symbols make it still the best choice for delivering a format implementation as widely as possible.
Re:The long goodbye to C
by vortico on Friday November 10, 2017 @02:16PM
(#15672188)
In my experience, most applications of C libraries are used in places where security is irrelevant, but even if it mattered, there are of course ways to write C without carelessly throwing around pointers. For example, an AIFF to WAV converter likely doesn't need to allocate any memory at all, it just takes a buffer with a length and writes to a buffer with a length. It's very easy to prove correctness of a large number of library decoders/encoders, but of course there are others which may be difficult.
Re:The long goodbye to C
by AndyKelley on Friday November 10, 2017 @06:03PM
(#15673824)
Go has a garbage collector and writing code in Rust can be extremely difficult. A third competitor is Zig, which does not guarantee safety, but is designed to make safety much easier. This is explained in more detail in this wiki article, "Why Zig When There is Already C++, D, and Rust?": https://github.com/zig-lang/zig/wiki/Why-Zig-When-There-is-A...
Re:The long goodbye to C
by tptacek on Friday November 10, 2017 @11:46AM
(#15671080)
Really? Download "reposurgeon" sometime and look at that code (note that it is one of the few examples of substantial code that Raymond has both designed and implemented in the public record for the past several years --- and that Raymond promotes it diligently; for instance, he took what felt like close to 10 minutes out of an NTPsec talk to discuss it).
He's _a_ software engineer, there's little question about that. But there are a great many of those.
Re:The long goodbye to C
by mwfunk on Friday November 10, 2017 @12:58PM
(#15671641)
He’s someone who has written a fair amount of software in his spare time (which is all of it, since his wife’s been supporting him for decades). He’s written some (IMO, at the time) entertaining writings on software development, but I don’t know if the work he has chosen to do or the circumstances under which he does it really qualifies him as a superb engineer. Fundamentally he’s kind of a bullshitter, and it seems like every time I thought he made a good point about something he screws it up by using that point to make some other point that is totally off the rails. He’s disappointing because he seems to have talent and potential to really contribute a lot more than he has, but he just can’t stop drinking his own Kool Aid long enough to be a positive force.
IMO, after observing this guy for 25+ years now, as a software developer and a writer on software development, everything he’s done has been 3 steps forward and 2-4 self-inflicted steps back. In politics it’s more like 3 steps back just for starters. I really wish he didn’t have whatever form of narcissism that drives him, because he’s clearly got some talents that could have been used in infinitely more effective and constructive ways over the last few decades. I’ve got to think that there’s some part of him that understands this, that’s always been the most frustrating thing about him. So much squandering of talent, just so he can pat himself on the back all the time. I’d say this applies just as much to his software-related work as it does to his politics.
I thought he was great for like 5 years, up until the quadruple whammy of the Hitler thing, his “I’m your worst nightmare” Comdex story that he was so proud of (or maybe that was at CES?), “Thoughts on Sudden Wealth”, and the whole aggrieved shitpiece he wrote about proudly tormenting some poor random Microsoft HR person over the phone.
For a lot of people, you only find out what really drives them when you see how they respond to success (or their own perception of success). He revealed A LOT in those years and has doubled down on it ever since.
Re:The long goodbye to C
by emodendroket on Friday November 10, 2017 @01:02PM
(#15671673)
While you're throwing stuff into the list, his articles about race (where he decides he isn't a racist; he just hates poor blacks for being "lumpenproles") and sexual relationships (he describes himself as a "natural alpha male" or something like that) are really, completely awful.
Re:The long goodbye to C
by jstimpfle on Saturday November 11, 2017 @09:24AM
(#15676465)
I'm not sure what I think about evaluating people on a public forum in this way, without them knowing. But anyways, I've read quite a few of his writings and watched at least one of his talks, and could not agree more. Good description.
Raymond is not in fact in a good vantage point to judge the suitability of Go or Rust as "systems languages". His claims to authority in this post are "NTPsec" and GPSD†, but Raymond neither designed nor implemented either of those programs: NTPsec is a hostile fork of ntpd, and GPSD --- which is probably not a good example of a program that makes particularly strenuous demands on its programming language runtime --- was maintained by Russell Nelson, after being written by a different team --- before Raymond claimed it for his resume.
In this middle of this article, Raymond claims that Python is suitable largely for single-user applications operating "at human speed". This is so far outside the reality of how Python is used in industry as to call pretty much everything else Raymond writes in the article into question.
Surely, somebody else has to have written something better on the trend towards next-generation systems languages.
† These are the examples he provides, in this article, by the way.
While it may be true that ESR is not a superstar programmer in the image of a John Carmack or a Bill Gates, he has been a working C developer for over 30 years, and has contributed to numerous open-source projects, including systems projects, over that period of time. The examples he lists in the article are some pieces of software which he is currently a maintainer for.
Actually I think the fact that he is not a superstar programmer with a signature project possibly makes him a bit more qualified to comment on language trends. After all, most of the developers in the industry are by definition about average, and if average (or even somewhat above average) developers are finding their productivity much higher in Python and Go than they do in C, then they will start doing more work in those languages and less in C. In fact, that transition is exactly what ESR is describing in the article.
Certainly it seems that Go is usable for certain classes of problems that would formerly have been C's domain.
I'd by productivity you count time to solution, a lot of applications written in python do not have performance requirements, which makes the comparison very unfair.
I cannot say for Golang.
Could you elaborate? Are you talking about e.g. numpy and scipy? Python is good at calling C libraries but that doesn't make it good for writing an IP stack or a device driver or an OS. Are you arguing against the "single-user" point or the "human speed" point?
It's hard to find programming language that will cover as much low level programming needs as C. If some aspiring hacker turns 14 today and wants to get into the low level systems programming/embedded programmer career learning C well is a must. They may use some other language more, but they need to know C unless they want to limit themselves.
Some processors have stack size just 2-8 and memory available can be something like 128B - 8KB. Any replacement must have programing model that is very low level. Any replacement for C must have very low level and simple programming model.
C++ may lose some ground to Rust but it may just end up saturated like Ruby, PHP did. Ruby is basically in steady state now. NodeJS jump in on a crowded market and got no where let alone it's crazy threadless model.
C++ btw have been pumping out new versions, C++17 was just completed by GCC and Clang is almost done. C++ is really trying to modernize.
Google whole backend is most likely C++... it ain't going no where.
Rust is a beautiful language but it still have a long way to go. And also resources such as books to help people jump on board not just general books either but books in different domain (scientific computing, data structure, web dev, etc.. whatever).
I haven't used it for very low level work, more for things like command line utilities (and with Lazarus for some light GUI app work). But the EXE/binary sizes are fairly small (without any optimization or stripping or compression). Also had used Turbo Pascal heavily much earlier. And I've read that Pascal at one time was used for systems programming; Apple may have been one company that used it (much earlier), and that their OS APIs were in Pascal. Windows API's (in Win32 at least) also may have had (not sure) some support for Pascal, viz. keywords like "long far pascal" in Win32 API code.
Side note: I wonder how many people use those abbreviations like viz. these days.
https://en.wikipedia.org/wiki/Viz.
And there are still some companies selling Pascal compilers for the embedded space, like this one https://www.mikroe.com/
They also sell Basic compilers.
Of course C++ can just revert to being mostly C in these cases, and C is lightyears ahead in tooling and documentation here, but as a language I think Rust has a decent shot at that space.
One of the benefits of being a truly actively developed language, as opposed to fossilized Java.
And even then none of that solves the problems I mentioned in the comment you replied to.
Who knows, maybe it even gets value types before the C++ community can agree what modules are supposed to be.
Edit/Continuation: I feel like the freedom offered by C works because of it's simplicity, and as a language for embedded systems I still enjoy developing in C. As someone who recently started working primarily in C++ though I am frequently astounded by the choices that were made. And to make things worse, offering C style controllability in a complex OO language doesn't work well. I shouldn't have to feel like I need to read the designers minds to predict how a language will act.
I think what replaces C should be something like Nim, which compiles to C and also has great C interop. C++ is definitely not it.
The security track records of nearly all large scale network facing C projects disagree with you.
Nothing prevents quitting structural code in C++. Or even functional for that matter. (Though function objects are not quite light yet.)
There are even safe subsets where at most you will get an exception when you try to do something dirty. Easy to enforce.
Certain things like compile time calculation (being enhanced by the moment) do not even reasonably exist in C or for that matter Nim.
The about one gripe with C++ is ABI or rather lack thereof. Three other is the amount of legacy code written in C or outdated dialects of C++.
In the safety critical programming we use subset of C or (C++) with static code analysis. It's possible to prove that there is no dangling pointers, divisions by zero, floating point exceptions (with assertions), out of bounds array access. It's called verification.
Programming is limited into MISRA C and then it's run trough static code analysis tool like Astree to prove that there is no runtime errors. There are still bugs, but they are not "typical C errors". Waiting for new systems programming candidates to get their toolchain to match the task.
https://www.absint.com/astree/index.htm
Ada, doing it since 1983.
C has no standard language provided range checks, and pointer security, but the amount of compiler macroses that do the same/coverage tools/runtime security tools/checks provided by compilers is huge.
At least part of "inherent issues" of C that Rust advocates often cite was long solved by these tools long time ago.
They are not a bullet proof solutions to lack of security features in C, but neither are the built in checks of novel languages. The amount of NX breakouts, syscall hijackings, clever tricks around range checks in so called secure languages being demonstrated every year confirms that.
For instance, I had a ETL program I was writing to process 100+ GB files. I pre-allocated all the memory I needed for exactly one row of data and immediately printed out the data when it finished that row (stream style).
The entire program processed 100 GB with lightning speed in less than 1K of memory. Maxing out the performance of the disk.
Best of all, I only had to free my memory at the end. Completely safe. No danger of double freeing and no extra memory allocation at all. Literally a dozen mallocs at the start and a dozen frees at the end.
Could I do that in Go? Sure. Would it have as optimized memory access? Maybe... but probably not. And C my entire program was 200 lines of code and absurdly fast.
Don't get me wrong, I love Go. I write programs in Go often. But for simple apps where the code can fit in a single file nothing can beat C. No bloat, no extra memory operations, and a code optimizer that has been being optimized for 30+ years. Go's code optimizer is not even close yet from what I can tell.
I don't know how you concluded that nothing can beat C because Go is most of the times slower.
You can see it has pretty similar performance for a problem [0] pretty similar to yours.
[0] http://benchmarksgame.alioth.debian.org/u64q/revcomp.html
Looking at that benchmark that tiny difference in performance would have have been very magnified in my use case.
Though I will concede that it is possible that while slower it might still max out disk I/O and once the bottleneck isn't RAM or CPU it doesn't much matter what language you use.
And based on that, Rust does beat C.
That is something I have not done in Go and is good to know. But I could be wrong on this one, I have no idea how Go buffers are performance optimized but reading a character from a C array is one CPU instruction... it feels intuitive that in Go just the fact the extra layer of abstraction is added on top means it will be more instructions on the CPU.
But that is just a gut, I have not tested it.
Which in my use case would make a big difference over time.
But my intuition also tells me that it would still max out disk access in Go with modern CPUs.
Edit:
I should mention that my use case was to processes as many gigs of files on as cheap an AWS server as possible while maintaining a very strict SLA on how fast processing should be (the data became obsolete in hours and when we tried higher level languages the data was obsolete before a single file could finish). So I was trying to squeeze out as many CPU cycles as possible.
I should also mention that Go didn't even exist yet in a stable state when I did this project.
Sorry if it's a naive question. My experience with C is limited.
90% of your program performance is going to be dominated by cache usage(unless you're doing something really dumb). With C you can place things next to each other explicitly so that your prefetcher/etc is automatically pulling in the data you need to the L1 cache.
Any ref'd/GC'd language is going to make that really hard(not impossible, but you have to jump through a million hoops like sun.misc.unsafe in Java).
Look up Data Oriented Design if you're interested in this stuff, Mike Acton does a great job covering it.
Not true at all.
Oberon, Active Oberon, Component Pascal, Modula-2+, Modula-3, D, System C#, Nim all offer ways to manually control memory outside GC control, just like C and C++.
Glad to provide Modula-3 examples to any C tricks you might want to do, or in D if you prefer something more modern.
Note that I didn't say that it was impossible, just that the ergonomics of GC'd languages don't tend to focus on performance in the ways that languages with explicit memory control do.
GC systems programming languages offer exactly the same explicit control as C does, in unsafe memory blocks.
Do you want to shot yourself like C in Modula-3? Declare a variable as UNTRACED REF, 100% like a C pointer.
Do you want a C union? Declare a tagged RECORD type.
Do you want a packed record to fill you cache line? Compiler alignment pragmas.
Allocation of value types on the stack or global memory section? Great, it is the default allocation type.
Bit fiddling to prepare a statically allocated buffer for a DMA transfer? UNSAFE code section.
Yet you just talked past my point to give some sort of soliloquy about Modula-3.
It doesn't matter how those languages died, it just matters that they did. The ecosystem and number of people who know how to write a language is almost, if not more important than the language when it comes to shipping software.
We should not think of Java when comparing system programming languages with GC against C.
Yes, the languages you mention meet all the technical requirements(congrats, here's your 10 internet points) it doesn't matter if I can't find people who know how to write it.
Since you seem to want to avoid talking about anything I raise I don't think it's productive to continue this conversation.
For example, all the work with System C# done in Midori has been being applied to C#, with .NET Native, ref returns, local ref variables, value tuples, regions with disabled GC, memory slices, with a few more down the roadmap, like effectively manual memory management presented at OOPSLA 2017.
Or the ongoing @nogc and BetterC improvements in D, Wallmart, EBay, Netflix, Remedy Games among many others, seem to be able to find people that know how to write it.
All it takes is 4-5 of these and now you're incurring performance hit of ~1ms which gets you into SSD territory[1].
As always, profile before making these optimizations but the OP was asking why something like this isn't possible in managed languages.
[1] https://arstechnica.com/information-technology/2012/06/insid...
"Re-write Linux in Go" I think would be a massive but classic folly
It happens to be a trope that C would have died if not for Unix[2], but to the best of my memory of reading programming books of the eighties, C's un-safety was a _feature_, not a bug (I remember Java books were _so_ apologetic that Java didn't have points arithmetic).
In the days before optimizing compilers and slow computers, the ability to write unsafely manipulate arrays was actually useful when one needed speed (and if one wanted to be a "real hacker", one needed to optimize every byte and instruction.) Now it's true that not every program needed that speed, and quite a few would be willing to trade speed for safety, but no "self respecting real programmer" would allow himself to write in _anything_ that wouldn't let him be that "uber-hacker" (sounds familiar? I guess Resume oriented programming is an old problem).
[1]. Before I get the pedants that C++ isn't C, I'd like to remind them that the Windows NT codebase started in the late eighties and early nineties, when C++ _was_ almost like C with classes.
[2]. In reality, quite a few languages took off which were not the same language as their OS (for example, Java, Python, C#). If anything, I'd say it's more important that the compiler vendor be the same company as the OS vendor (see Borland's history), but even that seems like a more modern problem (again, see Borland's history)
I never did manually resource management with them. RAII was already a thing in MS-DOS.
Java and C# were pushed by OS vendors.
C will be around for as long as everything under the sun has a C compiler. If you ask yourself when was the last time you started a C project, ask yourself when was the last time you wanted to write something truly (truly, including embedded) portable instead and there is your answer.
So until we get to replace POSIX across the board, C will be around.
It will take generations.
Bell Labs tried to kill their child and supplant it with plan-9 and inferno.
It failed.
Not because they were bad OSs, but because once you have market domination and code, things _must_ be backwards compatible.
If Linux/GNU didn't imitate POSIX, it wouldn't be any more popular than Haiku.
POSIX is clearly a standard for C unixes, but you could imagine a restricted subset of POSIX that didn't govern libc being applicable to a non-C Unix.
Any operating system written in a non-C language with no C support is going to break all existing C applications. This is inherent to OP's desire to remove all C. For the record: I'm opposed to removing all C.
So why not preserve unix-like shells, filesystems, devices, commands, etc? None of those are tied to language of implementation. Potentially existing unix shell scripts could run safely on a purely non-C system. Sysadmins would carry over some familiarity from existing Unix-alike systems. That has some value.
Unix servers make up 68-98% of the internet, depending on who is measuring. There's a huge body of sysadmins familiar with shell who are not familiar with Powershell.
So that's exactly my point: I don't think we should start from scratch on things like the Unix shell, filesystem hierarchy, devices, etc. People know them. Throwing out systems people already understand for no reason is a huge anti-pattern.
If you think Powershell is superior, port it to Unix and convince Unix sysadmins to use it. I don't think it's going to be very popular.
Once you've learned how it works having an object oriented shell is game changing. Powershell isn't necessarily the ideal implementation but I'm just calling attention to it as an existing, popular example of something better
"There are 8 standards and they all suck. We should make ONE good one to replace them all."
...
"There are 9 standards and they all suck. We ..."
Maybe, but there are projects like D's betterC[1] that are designed to remove that reason to use C as well.
[1] https://dlang.org/blog/2017/08/23/d-as-a-better-c/
If D became available in all of those embedded platforms, I am sure lots of people would rejoice. Or maybe they would just shrug because they would not know what hit them. But it would be their loss, because D is, in many ways, C++ "done right". Which IMHO is a remarkable achievement.
Either way, I would not hold my breath for C becoming obsolete in the sense of "no one is using it any more". It is not happy, but for now it is all we've got.
I'm one of those people and I spent ~6 years in embedded and I still write C today (though it's no longer my primary language). Of my former co-workers, probably 50 people in total across 4 teams, exactly 0 of them were at all interested in any sort of C alternative. I'd wager less than 6 of them even knew what C alternatives were even picking up steam. If it wasn't talked about by folks like Michael Barr or Embedded magazine, they simply wouldn't have any way of finding out.
> Either way, I would not hold my breath for C becoming obsolete
I wouldn't either. Call it the old guard, call them greybeards, it really doesn't matter. They're the ones buying chips from vendors that supply C toolchains and compilers. Until that is addressed, none of this talk matters.
As someone explained to me, it's the reason Rust doesn't have a nice initializer syntax like C++11 for example[1].
1. http://en.cppreference.com/w/cpp/language/list_initializatio...
it's not really how "everyone" uses it. it's a narrowing that a subset of vocal people have been trying to push, i can only presume for ideological purposes.
These aren't uncommon targets, the PSP traditionally had 8mb of system memory. Lots of embedded routers and "IoT" things, etc.
Part of this is confused by everyone having a different definition of "System Programming". In my view if there's a target where hardware constrains prevent suitable performance from a language then that language isn't fit to be considered a "System Programming" language.
http://www.projectoberon.com
The only thing that Go lacks in regards to Oberon are a few intrisics in the unsafe package, easily doable in Assembly, just like ANSI C requires on its libc for bare metal programming.
C gets put into a pedestal, yet it is impossible to write an OS in pure ANSI C, without making use of language extensions or Assembly.
I've done it and it's a pain in the ass. Why? Because the GC is _non-deterministic_. On many languages it can fire up at any time, freeze your threads at any time, and take however long it wants to. "But it usually doesn't take that long!" And? AND? The problem is, you've immediately added a blackbox thread attached to all your data. Enjoy having your program segfault in areas that are completely unrelated because the GC didn't run the finalizer till later. Enjoy having to fix a bug that doesn't have a repeatable effect. You're automatically writing multi-threaded code (and all the complexity that entails) even when you have a single-thread.
A GC adds an entire dimension to bug fixing and potential failure points. Every bug, multiplied by every possible interaction with the GC. This is something that systems programming usually cannot afford. You need to be able to prove your code won't crash.
And that's one more thing. Tons of systems code pre-allocates everything for that crash reason. So what problem is GC actually going to solve when everything is already carefully pre-allocated?
It really sounds like people who aren't used to unmanaged languages are simply projecting their fear of the unknown. I use both types on a daily basis, and to me they're just "the right tool for the right job." I would never try to shoehorn the wrong tool into an ill-fitted application just because I like that tool.
You're adding a ton of incidental complexity for a benefit that you can't take advantage of(programmer productivity) because you don't have the necessary resources to make it happen(large swaths of memory and > 50ms response times).
I was a Native Oberon user during the 90s.
Educate yourself on Oberon and Modula-3, read about Midori and then feel free to carry on the anti-GC campaign.
If you're interested in Rob Pike's take on Go, he expressed regret over initially calling Go a systems programming language, because it gave people the impression that it was appropriate for writing operating systems. He prefers to call it a "server writing language" or a "cloud infrastructure language." @6:45 in this panel discussion: https://channel9.msdn.com/Events/Lang-NEXT/Lang-NEXT-2014/Pa...
As for the links they are easy to find on my comments history.
I don't have to repeat them all the time the anti-GC crowd comes to town.
Note that the set of people who read your post today probably includes people who did not read your previous posts on the topic.
Rust is well suited for OS code if not for the inertia that most OS devs are experts at C and not so in Rust and compiler support. Those two factors are going to become less important going forward, so Rust (with generous 'unsafe') could replace C in its last stronghold too.
Additionally, alignment constraints are also really important at that level, but rust doesn’t have a mature way to align structures or arrays.
Rust isn’t ready for this space yet.
You're certainly right about "mature way" wrt alignment, but it's something that can be worked around until then.
[1] https://github.com/spotify/linux/blob/master/include/linux/g...
Hail to Erlang and even more, Elixir.
Otherwise you pay the cost when you really do not need to. Just ask people involved in actual places where microseconds matter, such as real time control or high frequency trading.
Erlang does not provide these primitives enforcing unnecessary copies in a bunch of places.
There will probably always be a need in computering for 'Portable Assembly' too, which is another reason C (or C like languages) will never disappear.
And I think it is even more true for FORTRAN
I was confused there for a second because both "CE" and "CS" literally start with C.
By the way, to add another datapoint, I completed a bachelor degree in CS from 2012-2017 (part-time) at a German university, and we used:
- C in the first-semester "algorithms and datastructures" course
- Haskell in the second-semester "programming" course
- Java in the third-semester "software design" course and accompanying fourth-semester lab course
- Python (very briefly) in the fifth-semester "information retrieval" course
Those picking up the optional compiler related lectures, also got an overview around Lisp, Algol, Fortran, Concurrent C, Objective-C, ML, Cobol, Oberon, Modula-2.
Nowhere C was taught as such, we were expected to know about it from the C++ lectures.
It’s less stringent compared to Rust’s borrow checker, but also has meta programming capabilities of similar power to macroses. The default is GC manged memory like in Go.
However it’s super flexible in that you can go from 100% simple GC-based programming with dynamic arrays and maps to hardcore low-level stuff with manual memory or anything in between (e.g. Ref-Counting as in C++).
He's _a_ software engineer, there's little question about that. But there are a great many of those.
IMO, after observing this guy for 25+ years now, as a software developer and a writer on software development, everything he’s done has been 3 steps forward and 2-4 self-inflicted steps back. In politics it’s more like 3 steps back just for starters. I really wish he didn’t have whatever form of narcissism that drives him, because he’s clearly got some talents that could have been used in infinitely more effective and constructive ways over the last few decades. I’ve got to think that there’s some part of him that understands this, that’s always been the most frustrating thing about him. So much squandering of talent, just so he can pat himself on the back all the time. I’d say this applies just as much to his software-related work as it does to his politics.
I thought he was great for like 5 years, up until the quadruple whammy of the Hitler thing, his “I’m your worst nightmare” Comdex story that he was so proud of (or maybe that was at CES?), “Thoughts on Sudden Wealth”, and the whole aggrieved shitpiece he wrote about proudly tormenting some poor random Microsoft HR person over the phone.
For a lot of people, you only find out what really drives them when you see how they respond to success (or their own perception of success). He revealed A LOT in those years and has doubled down on it ever since.