Hacker News new | ask | show | jobs
by avestura 380 days ago
Maybe I have a too strict definition of systems programming languages, but I would never call a GC language a systems programming language. Who would use an operating system that suddenly stops the entire world because some random language's runtime wants to collect its memory garbage?

That said, well done for making this.

10 comments

>but I would never call a GC language a systems programming language....

Lilith: x86-64 OS written in Crystal (github.com/ffwff). [1]. And Crystal has GC.

[1] https://news.ycombinator.com/item?id=21860713

Probably they meant that GC introduces a certain level of uncertainty, whereas OS or "systems" programming leans heavily towards manual handling (except when the compiler allows to avoid it, not the runtime).
I think you have some stereotypes about GC. In fact, current GC technology only requires a very short STW. Of course, I agree with your opinion, so this is not the final form of nature. I will find a better technology to assist GC.
I think it's rather the other way around. What parent said, even though they prefixed it with a 'maybe' to make their statement less confronting, is that you used the term "systems programming language" too freely. As is also the case with Go.

If people keep doing that, the term will eventually loose meaning. Maybe in 20 years, it will have eroded enough that something like Python will be called a "systems programming language". I mean after all, a printf statement in C also parses the format string at runtime. Who is to say the fact that all of the code is interpreted should thusly exclude something like Python? I'm being sarcastic, if that wasn't obvious.

Nature claims 'concise'ness in it's README's opening paragraph. That is laudable. It's even more laudable if the conciseness would also be reflected in the use of natural language (no pun) that describes it.

Calling it a "systems programming language" while using GC is IMHO eroding the meaning of the term.

Something meaning X and someone including Y and then someone pointing out that X does not include Y has thusly nothing to do with stereotypes here.

I don't want to disagree too strongly with use of the term "systems language" as my career is not tied to it, but I do think we should reevaluate it. "Systems" programming is in many ways a cultural term and not a technical one. It implies something about scale and reliability that is actually quite hard to tie to specific qualities of languages. In some sense, go is very much a systems language because it allows operating at high scale and high reliability. But in another sense, it is very unsuitable for "systems" work in the sense that you can't (trivially) swap out a kernel written in C for one written in go, although I suppose you could bolt manual memory primitives to the side, remove a bunch of features and runtime, and get it to work. But at that point you're just writing C in go with basically no benefit (and probably great cost if you consider how much weaker the go compiler is compared to LLVM or GCC), so it seems rather silly.

I worked in a "systems" lab as an undergraduate (basically, doing memory allocator research as an independent study) and my main workhorse was python because I was working with largely static data and then generating C. Is python a systems language? The idea is ridiculous. But I was definitely doing systems work. I think we need more flexibility in terms of how we view these cultural ties as inherent to the language as opposed to how it's wielded in context. Most of the time we can use a more specific term (eg "manually memory-managed", "C ABI linkable", "native", "reentrant", "able to use inline assembly", etc) with zero loss of meaning and great benefit in reducing arguing over terms.

Hell, if scala native could take off, it could be a real competitor to C++ and Rust. Is oberon a systems language? How about lisp? People have definitely written entire operating systems in both. Things get really weird once you wander outside the mainstream. Is erlang in a switchboard a systems language? I would say it should be considered such despite looking wildly different than C in just about every manner.

A systems language does not imply anything about scale and reliability. By your definition, Java would be a systems language, while C and assembly would not be.

A systems language is one that not only allows direct low-level access to hardware, but it's well suited for it. It not only works without a runtime (or at least a very minimal one), but it is its main mode of operation.

Many languages can do many things. Some are more suited for writing systems, and we call those systems languages. That rules out Go, Lisp, etc, despite people having written systems in them.

Well, that's fine, we're all entitled to our opinions.

Such a definition of systems language strikes me as borderline useless and vague, though, hence my request to chuck it out the window. (See also: high-level vs low-level is an even more poorly defined and useless term). I also don't see C (or rust, or C++) as having any unique affinity for accessing hardware—certainly, certainly not better access than lisp, which can often resemble an assembler with twenty megabytes of macros baked on top. Hell, I'd argue lisp is more systems-y and "low-level" than C is, which can't even be easily utilized to pump out a maintanable boot sector. It's just not built for that; it's built to generate object files, which then need to be lowered into binaries with a linker. Lisp is just flexible enough to rewrite itself into the target domain, which C cannot do.

Look, I'm not trying to argue about definitions; it's a waste of both our time. But genuinely, why are you so strident about using the term if you clearly have a more precise understanding of what you want to communicate? Why not just say "programming languages with access to an inline assembler and address lookups" (which, again, would include most common lisps)? Why not say "can link to the C ABI without relying on FFI at runtime" (which would exclude many lisps)? And granted, this only came up because it was used seriously in the original post, so the onus is really on everyone to care about how precisely they characterize language.

We should honestly just stop using "systems/high-level/low-level" entirely; they're too vague and get people too worked up. Which is just baffling to me; I have no emotional attachment to any programming language or similar tool.

Edit: you may find Game Oriented Assembly Lisp interesting: https://en.m.wikipedia.org/wiki/Game_Oriented_Assembly_Lisp

> But genuinely, why are you so strident about using the term if you clearly have a more precise understanding of what you want to communicate?

Because, up until I've read your comment, I've seen the term used with my definition pretty much everywhere, so I believe it's a fairly well understood and agreed on term, with you being more of an exception.

That's a very good point, and I agree with you. I will adjust the relevant wording and use words such as “system” more carefully.
Tbh, I've completely abandoned the concept of a systems programming language because the primary benefit of the concept seems to be to argue over it. There's practicality (eg can i link this into the kernel?) and then there's hand-waving about how it feels to a developer, and the conversation seems almost entirely subsumed by the latter.

See also: "is C a high-level or low-level language?" Just shoot me instead, please.

Somewhat agree, but it depends. I agree that core of the operating system (kernel) should be responsive, but there are many tasks in the operating system that don't require immediate response and can be run in batch. Usually these are higher-level decisions, such as any housekeeping tasks like file backup and indexing, workload reprioritization and optimization, system update and reconfiguration, and the like.
Yeah, then you write a GC or use a library ;)
Isn't this a problem of allocating and freeing resources being generally non-deterministic, regardless of what algorithm is used?
From the website:

"Nature is... A general-purpose open-source programming language and compiler designed to provide developers with an elegant and concise development experience, enabling them to build secure and reliable cross-platform software simply and efficiently."

That's true. However the website also promotes it as a systems programming language here and there. For example in the same homepage it says "Perfect for Systems Programming: Operating systems and IoT" and some other places like here: https://nature-lang.org/docs/get-started
I use Go for IoT devices in my work, such as routers and TV boxes, which run on RISC-V/MIPS/ARM32/ARM64, etc. I appreciate its portability; even on devices with only 512 MB of memory, I don't have to worry about memory overflow issues.

I believe nature is equally suitable.

Define operating system, the higher up the stack you go the less things like GC matter.

I wouldn't care if my network daemon was written in Python or not, but I would care if the networking stack itself was.

> the higher up the stack you go the less things like GC matter.

But suppose the very top of stack is high frequency trading system or traffic light controller. Car brakes...

Depending on your stack, determinism may or may not be a key part. And that is only possible if determinism is guaranteed all the way down.

I definitely don't want my traffic light controller to be written using manual memory management if this is at all possible to avoid. Waiting another millisecond for the light to turn green feels like an acceptable cost. But this seems silly: how on earth did you write such a simple program to have so many allocations that the gc significantly impacts performance? Why would a traffic controller need variable memory in the first place? Surely it's just a mix of a state machine (statically allocatable) and I/O.

"Determinism" feels like a very odd pitch for manual memory management when the latter in no way implies the former, and lack of manual memory management in no way implies non-determinism. Generally, any dynamic allocation is non-deterministic. Furthermore, in the HFT context the non-determinism of the network is going to absolutely dwarf any impacts GC has, especially if you have ever heard of arena allocation. Even your OS's scheduler will have larger impacts if you make any efforts to avoid memory churn.

Now, an interrupt handler should never allocate memory and should generally run with a constant number of cycles. But that's an extremely niche interest, and you'd probably want to hand-code those instructions regardless.

(FYI, I work in a support role to a HFT product, among many others, but it runs on the JVM)

Wowow. GO to not be used with systems programming? Absurd.
go is ill suited for many systems programming environments. It works well on servers and larger iot devices with 512+ mib off ram, but not great on things with tighter constraints. We tried to use it for our netstack implementation for years and ultimately came to the conclusion we needed to switch to a language with greater control. Storage, RAM, and CPU usage were all improved with the switch. I don't consider it a systems programming language but rather something approaching systems programming.
My jaw dropped when I read your comment.
If your program isn’t a system, it is unlikely that you need to worry about freeing memory at all — It will be cleaned up when finished.
in a sense, RCU is garbage collection.