Introduction

Nim is a statically typed programming language which produces native dependency-free executables. The nim compiler is also capable of compiling to multiple different low-level languages such as C, C++, Obj C, and JS.

The resulting code can then be compiled down to native executables at a later time, allowing easy integration with other languages.

Nim includes a feature-rich standard library and an ever-growing list of external packages available from the directory.

Andreas Rumpf initially developed Nim in 2005. Originally named Nimrod, it was changed to Nim with the 0.10.2 release in December 2014. Version 1.0.0 was officially released for general use in September 2019, marking a significant milestone in the languages’ maturity. The project is maintained by a community of volunteers and can be seen from the GitHub account.

Philosophy

The design goals of Nim in order of priority are:

  1. Efficiency
  2. Expressiveness
  3. Elegance

To achieve each of these design goals, Nim is characterized but not limited to some of the following features:

In the name of efficiency, Nim is a compiled language. Once compiled the resulting executable for the given operating system runs directly as native code. In comparison with other languages such as Java or Python, Nim does not need an interpreter and has no runtime translation overhead. This also makes it an excellent choice as a systems programming language, reducing the need to install and launch interpreters.

Nim has an expressive syntax. Taking inspiration from Python, Nim uses many of its best features and enhances them. It is intended to be readable and favours English keywords over punctuation.

It also uses indentation rather than punctuation to surround code blocks and restrict scope.

Helping Nim to be more expressive is its metaprogramming functionality. An innovative feature not found in many languages, it allows the syntax to be modified at compilation time. We will cover this topic in more depth in a later article.

Influenced by the English syntax from Python, introducing static types, adding extras like metaprogramming and macros. It’s clear to see how elegant our code can become. Nim, built on the shoulders of a giant, C, it embraces new ideas and features from modern languages such as Python and lisp.