Since I’m going to provoke trolls on the subject of programming languages, and even name the best one in the world (I mean absolutely the best, for sure), I recommend all of them to check out my previous post “Choosing a Programming Language”. Everything mentioned there is still up-to-date, and I wouldn’t’ like to repeat myself here.
Read it? Good. Today I am going to talk about the best programming language in the world, and I’ll name it closer to the end of this post. Three days ago I didn’t even think that unicorns existed, as each language sucks in this way or another, and each one does it in its own way (actually, there are some languages that always suck, but we won’t talk about them). As an engineer, I totally understood that the language question was impossible without various trade offs, starting from garbage collected vs. manual memory management and so on (Rust tries to gain without pain in this question though). Although we are talking about general-purpose languages, all of them are presented one way or another, focusing on some ideas, principles, and purposes they’re good at. However, they leave all the things that are not consistent with these principles barely possible, not effective, and/or inconvenient. To put it simply, they’re basically impractical. Nevertheless, there is a language that combines the incongruous.
As I have said, I faced the problem of choosing a programming language only in adulthood, about seven years ago, when I realized that Java was not what it used to be. At the same time, in search of productivity and a naïve desire to make Scala the main language in the company for the next 10 years, we bought early access (some chapters) of the not-yet-published book by Odersky et al. So, I had discovered Scala years before it appeared in CVs and heads of people coming for an interview, and some of you even didn’t go to school at that time. Working for a company that has produced customized IDEs for more than 10 years, I have seen lots of language trash and pure gold among it. Therefore, I'd like to ask all the captain Obviouses to think a little bit, before sending the author to a language history — do you really think that a guy who’s been searching for a language for seven years, and still cannot find it, doesn’t know about the history?
In recent years, the question of choosing a programming language has become more acute. We should begin a new technological revolution at Xored, and we have some ideas of smart technologies that allow making various Magic, but I wasn’t ready to start anything for a very long time. Why? The answer to the question still surprises me. If I got such answer on an interview, the guy would definitely get a “minus” from me. The answer sounds really silly and childish: I did not know in what programming language I wanted to see the stack of our brilliant technologies. The only excuse I have is that I’m really focused on a long way. I’m not talking about some certain project. It is something I want to invest the best years of my life in. That's why this question is so important to me.
Setting out on a long and difficult journey, it’s really dangerous to make a wrong choice of vehicle. All recent years I’ve been looking (waiting?) for a programming language (a platform) that wouldn’t make me want to reject it due to some reason. Having quite ambitious goals, I had certain functional and non-functional requirements to such programming language.
What I want is high-performance code in the browser. I also want to be able to run my code on unikernel/cloud os. I want a high-performance server-side with large volumes of information processed. I want iOS and Android (high-performance as well). I also want to develop all of this with no hassle. I don’t want to bother about code generation and work with memory directly through a narrow gate as sun.misc.Unsafe. I also don’t want to develop large arrays like a mathematician in Fortran.
I want to write very low-level code (close to bare metal), and have performance comparable to native C/C++. I want GC when I need it, and I don’t want GC when it’s not necessary. I want to write object-oriented and functional code. I want to overload operations, define higher-order functions and use closures. I want generics, and I may want templates and/or macros to implement some future concepts. I want to understand how all of this is implemented in the language, starting with memory and concurrency models. I also want to control these things the way I want to.
Here’s a dump of things I want. Well, it’s obvious that I want everything at the same time. I might be the first one to say that there’s no such language. But there is.
Cross-Platform. Close to Bare Metal
Actually, I was moving this way, but, getting back to the subject of the article, it’s the way against the language. I programmed against the language, or rather JVM platforms, that is actually orthogonal to the task solved. To solve my problems, I need everything the platform gives but in a different, DIY way. I need an off-heap memory management and a system of value types of my own. To make all of this work properly, I also need code generation (compile-time and/or run-time). Thus, the following question arises: “Do I really need all of these languages and platforms (JVM, the browser), if they don’t help and even stand in the way?”
JVM Off-Heap Data Structures
There are definitely lots of decent projects moving “against the platform”. If you’re interested in Java contest, I can recommend you various sources. You can start with the Mechanical Sympathy blog. These guys have produced lots of interesting things with JVM. As for performance, they show how to show 15 to 35 times better results compared to ProtoBuf. As for Off-Heap data structures, this post has an example showing a 40-time increase in productivity compared to the use of language (Java) as designed.
I would also like to highlight the little known (or rather quite unknown) landz project. The author offers a new platform on top of JVM with lock-free/garbage-free off-heap memory allocator, lock-free collections, async-await, channels, off-heap collections, etc. Pretty cool… I should also mention objectlayout.org and other things, but all of these are inconvenient and is being made despite the platform design, not thanks to it.
Browsers, asm.js and emscripten
More Appropriate Language? (low level)
Seems like I started to flush the beloved JVM, but it’s too early for that. First of all, we should take a look at the high level: Scala and other friends, but we’ll talk about them in the following post.