Are you a Nim-by? C-ish language, gentler than Go, friendlier than Rust, reaches version 1.0

We are the knights who say... Nim!

after-party mess

The Nim programming language reached v1.0 on Monday, bringing with it a stability guarantee and enthusiasm from its community of fans.

"Version 1.0 marks the beginning of a stable base which can be used in the coming years, knowing that the future versions of Nim won’t break the code you have written with the current version," the Nim team said on Monday.

Nim is a compiled language, like C, rather than an interpreted one, like JavaScript. So it tends to perform well, because compilation translates source code into efficient native instructions for specific hardware. It's also statically typed, like C and Java, which avoids certain type-related bugs and can improve performance. The language and compiler are offered under the MIT license.

What's more, Nim supports memory safety while also being fairly approachable – the code is reasonably easy to read and understand. And it can be compiled to C, C++, Objective-C or JavaScript. It offers both automatic memory management (Garbage Collection) and manual memory management.

Some example Nim memory management code

Click to enlarge

The team's goal is to ensure Nim code compiled under 1.0 will still compile under 1.x releases. Stability and better documentation were the two most requested features in a Nim community poll published about a year ago.

Nim's creator, Andreas Rumpf, known as "araq" in the Nim community, celebrated the milestone in a blog post. Version 1.0, he said, will follow a more disciplined process for adding new features.

"Starting with version 1.0, we follow the 'spec first' development: First we write an RFC, then we discuss it, then write the spec, then we implement it, then the insights gained from the implementation flow back into the spec," he explained.

Nim has been described as somewhere between Go and Rust in terms of ease of learning. It has also been described as a faster Python that prevents typos. Python is a common touchstone because, like Nim, it's easy to read.

"Nim is a compelling small language with a syntax inspired by Python and strong functional capabilities and rapidly evolving libraries," said Jamieson Becker, CEO of Userify, in an email to The Register. "The tooling is quite nice and pleasant to work with as well."

Becker also praised Nim's cross-platform capabilities. "I do have some constructive criticisms as well, but I think they'll be resolved in a few more years as [Nim] matures."

Becker, in a post on Hacker News earlier this year, said Nim deserves consideration as a systems programming language, alongside the likes of Rust, and should soon become more appealing as an application language as Nim libraries mature.

In an email to The Register, Timothee Cour, a senior machine learning engineer at Lighthouse, said Nim’s advantage is that it gives you the speed and portability of C, the ease of use of Python, and fast compilation, with the ability to have your entire stack – mobile, frontend, and backend – using the same language and standard library.

“Like D, Nim is relatively unopiniated and supports multiple programming paradigms (imperative, generic, object oriented, functional),” he said. “However what truly sets it apart from all other languages is its unique metaprogramming features.”

“Nim macros in particular allow manipulating the syntax tree to write custom DSL’s, eliminate boilerplate, automatically generate bindings (nimterop) or command-line interfaces (cligen), integrate with python (nimpy), automatically serialize/deserialize (eg protobuf-nim), generate React-like single page web apps (karax), and more generally allow libraries to extend the language without bloating the compiler. And because all of this can be done at compile time, you also avoid the need for makefiles or complex build scripts.”

The language, which shares some similarities with Haxe, is not very widely used at the moment. Beyond Userify and, only a few companies are deploying Nim code. But developers who have tried Nim tend to speak well of it, which suggests that the language will continue to win more fans. ®

Sponsored: Beyond the Data Frontier


Biting the hand that feeds IT © 1998–2019