
Ask HN: Systems programming laanguage of the future? - globalrev
Most OSes and systems programming in general is mostly done in C (and C++?).<p>The language has some clear flaws from what I understand but there aren't really any alternatives are there?<p>Why is C so fast? Because people make it fast or because it is easy to write fast compilers for it?<p>Why aren't other languages used for writing OSes? They just don't have the speed?
JAVA is used a lot for server-programming right? But doesn't cut it speedwise for OSes?<p>As we move to the cloud and the OS becomes less important will C disappear as new systems replace the old ones?<p>But you will still need some small basic OS right? So will people program in C in 10 years or will compilers have gotten so smart will be writing that in Haskell, Python or JAVA?<p>Why hasn't anyone created a better systemprogramming langauge?
======
silentbicycle
I've heard several times (citation needed, I know. Anybody?) that processors
have gradually been tuned to perform better with machine language that has
artifacts from C compilation in it, or something like that. I would love
details. (Related: <http://www.c2.com/cgi/wiki?CeeAsAnIntermediateLanguage>)

Python won't be used as a systems programming language because it's relatively
slow compared to most compiled languages (though many parts of its library are
compiled C) due to two major strikes against it: It's interpreted (albeit with
some bytecode caching), and it doesn't (yet) have a clear way to declare/infer
types for optimization, so a lot of cycles get burned double-checking data
types. In practice, it's usually fast enough for most purposes -- its design
focused on speed of development over than execution, which is a good tradeoff
overall, but works against it for systems programming (except prototyping).

------
warwick
Off the top of my head, I'd say that C is used for systems programming due to
direct addressing of memory via pointers and it being as low level as you can
get without getting into machine specific assembly. Speed is more of a
byproduct of being extremely low level since you've got very low overhead.

I'd be curious what you see as the inherent flaws in C, and what would you
want to see out of a better systems language?

~~~
globalrev
Well I don't know it very well, that's partly why I'm wondering. But it is not
very expressive. Is it not possible for example to have higher order functions
in a low-level language? The type-system could be made safer(learn from
Haskell).

~~~
wmf
OCaml may be a good candidate; consider the example of Melange which was 1/3
the LOC of equivalent C with the same performance.

------
rincewind
There are operating systems in other, higher-level languages: Singularity,
JNODE, Genera, SqueakNOS, Movitz, but:

C is not garbage collected. If you write an OS in a dynamic language you need
either a GC in a low-level language or one that does not produce garbage
itself. If you want a realtime-OS, garbage collection will make things much
more complicated.

Other dynamic featues like multiple dispatch at runtime may also slow down the
system and create an unnecessary bottleneck at such a low level.

> Why hasn't anyone created a better systemprogramming langauge?

Java is a very good systems programming language for Processors that have Java
bytecode as machine code.

Oberon is a better language to write the Oberon system in than C. There is
also a lot of low-level programming going on with Ada. Oberon and Ada are both
derived from Pascal and seem very un-dynamic to me. Depending on your
definition of better, they may be better sytem programming languages.

------
brianobush
There is the D programming language, but it hasn't caught on.
<http://www.digitalmars.com/d/index.html>

------
wmf
Legacy, of course. Beyond that I would look to the language semantics, not
performance.

