What Do We Need From a System Programming Language?
There are a huge number of programming languages to choose from, but only a few are described as system programming languages. If we could have anything we want from a new system language, what would it be?I recently announced the first Alpha release of the Heron programming language 1.0 on Artima.com. I talked a bit about the evolution of the language design over the course of the last five years. Some people who remembered the language from back when, commented on how they were a bit sad to see it become less of a systems language and more of an enterprise type language.
I think that the Heron feature set would permit it be used as a system language, but it would require this to be clearly demonstrated. I am thinking that the next steps for Heron are going to be implement a Heron to C or C++ compiler. This might be a good way to prove the viability of Heron with all of its fancy-pants features being used a system language.
The term "system programming language" is not super well-defined. Most of us "know it if we see it". Some programming languages that I consider to be system languages are: C, C++, Modula-2, Oberon, Fortran, D, Forth (am I missing any?). My rather unscientific criteria for a system language is: can you write an OS with it, without having to heavily rely on a foreign function interface (FFI) to C?
So I asked Nemanja and Achilleas on the Artima discussion forum of Heron what they would look for in a system language, and here is my take on their wish-list combined with my own:
Must have features
- compilation to native platform binaries
- tight control over resource management (e.g. optional garbage collection)
- compile time code execution
- typed memory management
- direct access to system resources
- efficiency both in CPU and memory consumption.
- no hard dependency on a runtime (e.g. VM or library)
- all high-level abstractions strictly follow "pay only for what you use" policy (e.g. polymorphism, closures, RTTI)
- deterministic resource deallocation
- a very static ang strong type system that would catch as many errors as compile time as possible
Nice to have features
- type deduction
- full support for functional programming
- simple FFI to C
- full support for dangerous actions like pointer arithmetic, but *not* defaults.
- a context-free grammar
- side-effect detection and enforcement
- explicit signature-based polymorphism
- A rich set of standard libraries that can be optionally linked if needed.
- A choice of static and dynamic linking should be provided
I found this to be an insightful wish list of features. It is definitely helping to guide my thinking about some features of Heron. What features would you expect from a modern system language?What features would you expect from a modern system language?