Ask HN: What is must-have for a systems programming language?
Obviously, any systems language must have predictable memory layout for at least a subset of its types, including atomic (as in primitive) and composite types -- but probably it's not quite necessary (nor possible) for function types.
What are other language features that are similarly crucial? I'd argue even arrays are kinda optional, since they can be encoded as `Array = exists (n: Size, a: Type); (repeat a > take n > reduce ((x, y) -> (x, y)))`
11 comments
[ 3.3 ms ] story [ 37.7 ms ] threadIdeally, it has to support a return stack, and a data stack.
I've seen ROM code that couldn't assume a return stack... not fun.
It would be really, REALLY nice if it could manage reference counted, counted, automatically allocated, strings, so that you could just use them without needing to allocate/free them, etc... just return a string like you return an integer.
How do you think automatically managed strings might work, so that there is as little hidden code and costs as possible, but still decently ergonomic for your taste?
Would you consider automatic strings good enough if restricted to (a) statically known length, (b) statically known buffer size, or is it only worth it when they can be fully dynamic?
Though that might count as too complex of a runtime for "low level", the idea is sometimes used in compilers to speed up and ergonomize basically everything that might deal with strings, which compilers do a lot.
The answers to all of the above will have an impact on your language features: how you import, how you declare foreign entities, what visibilities are possible, what data storage classes are theere, what is the module initialization order, what code can be executed during module initialization, what is your conditional compilation mechanisms?
I'm more interested in surveying the boundary between systems and application languages, rather than exploring the design space for a systems language.
In other words, what Python, Haskell or JavaScript lack that systems languages must have?
- Static typing. System-level programming often has more complete requirements and more stable requirements than, business information applications. Languages for system-level programming should utilize that.
- Ability to run without heavy runtime-system.
Procedures? In and out parameters? Return values? Pointers? References? Integers? Signed? Unsigned? Structs? Unions? Arrays? Goto? Loops?
Do you enjoy implementing variable length encodings? What do you imagine would make that less error-prone?
What an application language can't have that a systems language can? What a systems language cannot ever afford and how to cope with that? What a systems language can afford lacking that an application language won't get away with?
I need your hottest takes!