Hacker News new | comments | show | ask | jobs | submit login
What is low-level or system programming?
2 points by eriksank 1868 days ago | hide | past | web | favorite | 4 comments
C is considered a low-level or system programming language. If a C library were a duck, this is what you can do with a duck:

#include <dlfcn.h>

void* library = dlopen("./duck.so", RTLD_LAZY); typedef void (*duck_t)(); duck_t hello = (duck_t) dlsym(library, "walk"); walk();

Since you could create duck.so in Pascal, C++ or D, they can also be used effectively as system programming languages.

Java nor C# can walk like a duck, not even if that is what it would take to save themselves from drowning. The Go language cannot do this either.

For a language to be considered a valid substitute for C, it must simply be capable of walking like a duck. What other system programming languages are there around? What other languages are capable of walking like a duck?

That duck thing doesn't explain what system programming is. Even though you may not want to do it, or have it explained to you, I'll take the liberty of defining a few basic principles. For any language to be considered a system programming language I think it must do whatever assembly language does, obviously with better syntax. Stack manipulation, memory access and transfer, software and hardware interrupts/ports access and obviously logic and arithmetic.

Andrew Tanenbaum taught us that a computer and its software can be defined as one translating layer sitting on top of another. At the basic level you find the electrical circuits inside the chips. Above that you find microcode which defines assembly language. Above that you find the bios. Above that you find the Operating system and finally above that you find application, userland software.

The problem with .Net languages and Java is that they sit in userland, four steps away "from the metal". So another way to define system software is software that's within 3 layers of abstraction/translation "from the metal". When you have defined system software, you have defined system programming. To summarize: as long as your language can be cleanly translated to basic assembler and can do stack manipulation, ports/interrupt access and memory manipulation, it can be considered a system programming language. Pascal was used in the first implementations of Mac OS and even some versions of BASIC could have that capability like XBASIC (www.xbasic.org) or Freebasic (www.freebasic.net) without loading additional libraries (at least read their manuals before considering the contrary).

One last thing: KILL THAT DUCK. The way you formulate your question borders on trolling.

Unfortunately, you are beating around the bush.

It is perfectly possible to create "duck.so" in C. Any other language having a dlopen() and dlsym() will be able to find the "walk" symbol in it, and execute it.

C is being used all the time exactly for this, regardless of what Tanenbaum says.

If Tanenbaum believes I should not want to do this, that's his problem, because I want it anyway. Tanenbaum has no authority whatsoever to tell other people what they should want.

Your question was about what defines a system programming language. I answered that. I don't care about ducks.

Your definition does not include that a system programming language must be respectful of the dlopen() and dlsym() functions. In all practical terms, it has to be; otherwise, it is not a valid system programming language.

Guidelines | FAQ | Support | API | Security | Lists | Bookmarklet | DMCA | Apply to YC | Contact