lp0 on fire

My personal blog

Programming: Language wishlist

In the past years I've had the luxury to try a couple of different programming languages and to use them professionally. Each language has it's own pros and cons, but almost every time I end up going back to C99. However, the language itself leaves a lot to be desired due to the lack of modern facilities like generics (intoduced in C11, but a bit awkweird) and the way it handles strings. So, I grabbed my laptop and started writing down what I liked and disliked of various languages, concepts and principles deployed.

1. I want control

One thing that I miss in most modern languages is full control. Most languages these days have been designed with safety in mind, but that's not what a good programmer needs. It's like antivirus software on a computer; if you know what to do then you don't get virusses. A skilled programmer should know how to do things as efficiently as possible without breaking things, and otherwise be able to fix it instead of having to fight the language's safety systems.

I want to be fully responsible for how, when and where memory is (de)allocated. I don't want to write unsafe for things that are totally safe to do if you stay level-headed.

2. I want zero (optional) runtime subsystems

Modern languages include many features like state machines (async), exceptions, GC/RAII, etc. While they all provide their own benefits, they all include a cost paid at runtime. I think these features are better suited as options outside of the language, as all of these can be supported externally. It also helps with reducing edge-cases and lowering implementation cost of the language on other architectures.

3. I want data-oriented programming

While object-oriented languages have their own stengths, I think the cost, complexity and mindset assosiated with it is not worth the price. There is no accepted mathmetical model for validating correctness of the program, making it hard to prove the absence of bugs. These languages also usually don't provide facilities for data locality of inherited classes, which trashes CPU cache.

By separating data from logic, we get a clear distinction on how things influence each other and how it would translate to machine code.

4. I want convenience

Making everything source private and immutable by default does not only provide safety, but also many more chances for optimization by default opposed to having to write all of it by hand in C.

Besides being able to make a type alias, I also want the ability for operator and cast overloading, as well as defining the initializer of the user type so that they feel well intergrated into the language. I want support for generics and method overloading to reduce the amount of work that needs to be done to support multiple types for a function.

5. I want minimalism

Huge standard libraries are nice at the beginning, but it is oftentimes not the best solution available so you end up using a specialized library. So why include it in the first place? The language doesn't need 3 different ways to iterate over data either (while, for, foreach). I don't want labdas nor closures either.

I want the language to present only one way of doing things with keywords, and that the language specification can fit inside my head. Standard libraries shouldn't be required to be supported on every platform, and should be replacable by custom implementations that suit that platform.

6. I want C-like syntax

Instead of the label: t = value and fn label(label: t) -> rt trend going on, I just want t label = value and rt label(t label) syntax found in C and derivatives. It takes less characters, is more streamlined and is easier to understand at a glance.

Conclusion

I really just want a weird mix of C99 with some features from Rust and C#. I'll show in the next article what this would look like!