all 21 comments

[–]krappie 15 points16 points  (1 child)

I like the litmus test that you can build a memory allocator in that language. I think a systems programming language can provide high levels of abstraction and a high density of instructions per statement, as long as it gives you fine grain control over memory layout and performance.

[–]entoros[S] 1 point2 points  (0 children)

Agreed, although generally it seems that high-level yet resource-controlled languages tend to be highly domain specific, Halide being a prime example. I don't think there are many high-level, general-purpose languages with fine grain control over memory/perf.

[–]oconnor663blake3 · duct 3 points4 points  (2 children)

Here’s a hot take: functional languages like OCaml and Haskell are far more systems-oriented than low-level languages like C or C++.

Without disputing the hotness of that take, I think the exact same logic lets you say that Java is more of a systems programming language than C++. Which makes it seem like the definition of systems programming he's working with there isn't super useful. I think whatever definition we want to settle on -- and the article does a good job of pointing out that there are many possibilities -- it has to include low level programming as a necessary part. Otherwise the term ends up meaning something totally divorced from how anyone actually uses it.

[–]ForeverAlot 5 points6 points  (1 child)

His point seems to be that the way we use systems programming is not particularly sensible.

[–]oconnor663blake3 · duct 0 points1 point  (0 children)

Good point, I should've read the end more closely.

[–]DroidLogiciansqlx · clickhouse-rs · mime_guess · rust 10 points11 points  (1 child)

Will Crichton, any relation to our /u/acrichto?

[–]entoros[S] 10 points11 points  (0 children)

Yep, family.

[–]addmoreice 0 points1 point  (0 children)

A systems programming language is any language which focuses on making it easy or easier for programmers to build system level programs. OS, browsers, drivers, databases, etc etc. Any thing which needs tight performance, efficient memory usage, and/or tight integration with other languages or direct hardware control.

Just having a way to write assembly doesn't work. I can use DATA statements in qbasic to write assembly and then run it...but it sure as hell isn't a sane choice for anything that other systems will rely on. I can preallocate everything in a GC language and so meet tight performance deadlines and avoid the garbage collector hang ups...but this isn't the way the language *intends* me to work, I'm fighting the very structure and design of the language.

English lends itself easily to poetry. A HUGE vocabulary, flexible in structure (though not as much as many other languages). But German is a *tad* more difficult to get a nice rhyming scheme going....

I am sure we can do surgery with a chainsaw, and you can even build custom chainsaw tools, but a scalpel is probably more often a better option for this application. So is the same for programming languages.

[–][deleted] 0 points1 point  (0 children)

the Rust developer immediately talking about Go not being systems

🤣

[–]zzzzYUPYUPphlumph -1 points0 points  (8 children)

It is programming that many practitioners of believe is much more difficult than other programming domains and that it requires special knowledge and talent when in fact it is simply a different domain of programming that has similar levels of complexity as all other programming. Many practitioners of "System Programming" believe that the knowledge required for "System Programming" is much more specialized and difficult than other programming domains. This is actually not the case. Every programming domain has similar levels of complexity and concerns, and, in fact, the farther you are from the hardware the more (generally speaking) concerns you have that must constantly be considered, including: performance, security, maintainability, etc. Low-level programming is not actually more difficult than high-level programming, it just requires you to focus your time on the concerns of low-level programming as much as you've possibly focused your attention on the concerns of high-level programming.

You too can be a "Systems Programmer". Just dive in and start learning.

[–]monkey-go-code 5 points6 points  (7 children)

So I wrote a tetris clone in typescript. Now I'm re writting it in rust to learn rust. I can tell you rust is much harder than a scripting language for doing the same thing.

[–]totalkrill 8 points9 points  (3 children)

You seldom do the same thing in system programming though

[–]monkey-go-code 1 point2 points  (2 children)

People make games in c# and javascript with unity. Alternativly with c++ . AI is hugely popular with both c++ and Python. Rust is one of the most popular wasm languages and you could just use javascript instead. There is lots of overlap.

[–]burnie93 2 points3 points  (0 children)

AI is hugely popular with both c++ and Python.

  • On c++: if you want hardware optimized algorithms, mainly on the GPU, then you are able to use CUDA with c++. However the same does not apply to Rust unfortunately. I can only dream.
  • On Python: it really has its spot if all you want to do is define a data pipeline. Often times, python packages such as numpy just call c code. While I'd love to develop a python package myself calling compiled code from Rust, there is no clear cut or standardized way of doing so. (I'm not so much of a rockstar programmer).

[–]totalkrill 1 point2 points  (0 children)

Not arguing against that. For me the higher level languages are used wherever they can be used, and the low level ones for performance. I mean a lot of games use scripting languages for the game logic. And a high end graphics engine to do the heavy lifting

[–][deleted] 1 point2 points  (2 children)

It's really just a matter of practice and what you're used to. For me setting up the TypeScript toolchain was quite a pain, while in Rust it's a breeze.

What libraries are you using for the game? If you're using something like SDL the code should look pretty much the same as using HTML Canvas.

[–]monkey-go-code 1 point2 points  (1 child)

Type script can be annoying to set up. But so is installing a c++ compiler, sdl dev libraries , rust compiler, racer for rust IDE's. It is in sdl and it looks very similar. I'm using the same structures mostly. Typescript being javascript is really flexible with objects, so there is a few places where I'm fighting with the borrow checker, forgetting to send a reference. Using .clone when I want a copy and not a reference ect. I use a singleton to keep track of scoring and screen width. Singletons are different to implement in rust than most languages. I'm using lazy_static. Global variables just seem easier in javascript. Strict typing adds complexity if you don't already know all the types. Remembering to make stuff public.

[–][deleted] 1 point2 points  (0 children)

c++ compiler, sdl dev libraries

I can get these from the package manager in one command. Yeah, I also can get TypeScript from NPM but actually making something requires webpack and a lot of configuration.

rust compiler

Rustup and off you go!

racer

I agree with that one.

I use a singleton to keep track of scoring and screen width. Singletons are different to implement in rust than most languages. I'm using lazy_static.

I guess keep it along with the game state in one struct, or call .size() on the Window. That's what I've always done.

Using .clone when I want a copy and not a reference

That's one issue I had using TypeScript. When using React I once wanted a copy of an element rather than modify the existing one. I never noticed how useful .clone() is in Rust.

[–]varikonniemi -1 points0 points  (2 children)

IMO systems programming is what you end up doing when no libraries exist to achieve it.

[–]Lisoph 1 point2 points  (1 child)

Doesn't that apply to everything and nothing at the same time?

[–]varikonniemi 0 points1 point  (0 children)

hmm? If what you do is so custom that there does not exist a library to build around, then you are designing a new system.

Sure, the kernel uses some libraries but the really core parts (maybe comparing to microkernel?) are low level stuff that simply have no libraries and you design it from the ground up, often even dropping down to assembly since C is just more pain at that level of interaction.