Richard Bucker

The Perfect Programming Language

Posted at — Feb 14, 2015

I’ve just read a two articles. One talked about learning OCaml instead of Haskell and another talked about switching from Mozilla’s Rust to Nim. One in particular said that there was “no perfect language” and while I’m on the eve of presenting at go-Miami with a strong admiration for Google’s Go there is nothing like good old-fashioned C.This post has started to get away from me. C is still the perfect language. It has the history and the tools that keep it in the #1 position. C is also the foundation for many other languages and there are interfaces to many more.And it got away againIn my ideal environment I would be implementing a framework in C and then deferring the task to another language to something like embedded tcl or even lua. One excellent example of embedded tcl is fossil-scm. And an example of embedded lua is Adobe’s Lightroom.And so I like Nim because it generates C code which could then embed tcl or lua; and why not both. Libraries can be implemented in any of these languages providing the necessary guard rails, cross OS deployments, and the ability to scale from any of the languages to C and back as needed.C still has so much potential. It’s debuggers, libraries in every corner of programming from operating system kernels, device drivers, to applications and beyond. One last thing. Few languages are bootstrapped in their own language. They all started somewhere and it was probable C.PS: Several languages are experimenting with translations to javascript. It no simple feat as there are so many impedance issues. This includes threading or concurrency, callbacks, basic language features that have to be simulated, and the differences between the many javascript implementations. While is novel and marginally useful it’s not going to replace the existing javascript ecosystem.UPDATE: I just installed nim-lang.  Compiling 0.10.2 from source took less than 5 minutes. While I only played with hello_world I was able to produce javascript and c code. The compiled C program was only 163K in size as it probably included the stdio lib and maybe a few more. And while the generated C code was almost readable the javascript was unintelligible. I’ll also note that nim will output code for Objective-C and C++.