Nim

Efficient, expressive, elegant

Nim, formerly known as Nimrod, is a statically typed, powerful, imperative programming language that doesn’t compromise with runtime efficiency. Having a syntax similar to Python, it encapsulate the best features of Go, Python, Rust, and Lisp. Despite the challenges faced due to small community of developers, Nim allows one to create robust and fast software.

Nim has been under development since 2008 and its most recent release is 0.16, which was made available earlier this month.

The syntax of Nim might remind you of Python as it uses indented code blocks and similar syntax on some occasions. Just like Rust and Go, it uses strong types and first-class functions. Nim is object-oriented, but with composition preferred over the inheritance.


Efficient

  • Nim generates native dependency-free executables, not dependent on a virtual machine, which are small and allow easy redistribution.
  • The Nim compiler and the generated executables support all major platforms like Windows, Linux, BSD, and macOS.
  • Fast deferred reference counting memory management that supports real-time systems.
  • Modern concepts like zero-overhead iterators and compile-time evaluation of user-defined functions, in combination with the preference of value-based datatypes allocated on the stack, lead to extremely performant code.
  • Support for various backends: it compiles to C, C++ or JavaScript so that Nim can be used for all backend and frontend needs.

Expressive

  • Nim is self-contained: the compiler and the standard library are implemented in Nim.
  • Nim has a powerful macro system that allows direct manipulation of the AST, offering nearly unlimited opportunities.

Elegant

  • Macros cannot change Nim’s syntax because there is no need for it — the syntax is flexible enough.
  • Modern type system with local type inference, tuples, generics, and sum types.
  • Statements are grouped by indentation but can span multiple lines.

To stay updated with such content follow us on

or subscribe to our newsletter


What can Nim be used for?

According to developers Nim can be used to Build command-line applications, games, web servers, kernels and everything else in between. Nim has a low barrier to entry and offers powerful features you won’t find in many mainstream programming languages.


According to Fossbyte

Nim, formerly called Nimrod, calls itself a statically typed, imperative programming language that “gives the programmer ultimate power without runtime efficiency” compromises. What does it mean? It means that Nim focuses on compile-time mechanisms in their various forms. A semantic model supports soft realtime GC on thread local heaps.

Nim focuses on thread local heaps and messages passed between threads. As each of them has dedicated GC, there’s no need of “stop the world” mechanism. Talking about the benchmarks, it’s comparable to C.

Nim compiler produces C code by default. With the help of different compiler back-ends, one can also get JavaScript, C++, or Objective-C.

Nim compiler and library are MIT licensed. Thus, it allows you to use any license for your programs that use Nim.

Why Python

Python’s popularity and beginner friendliness has led to a wealth of tutorials and example code on the internet. This means that when beginners have questions, they’re very likely to be able to find an answer on their own just by searching. This is an advantage over some languages that are not as popular or covered as in-depth by its users

While Nim could be a mix of best features of tons of languages, but that only is not good enough to get it into general circulation.

With one of the largest active and helpful community backing Python, Nim’s gonna be in a very tight spot.

Also, python comes with tons and tons of libraries which can be used to easily get on the track for beginners.

Other advantages of Python include
  • Good documentation
  • Cross-platform
  • Can be used in many domains
  • Has many libraries for scientific computing, data mining and machine learning
  • Supports various programming paradigms
  • Very similar to pseudo-code
  • A good introduction to data structures
  • Easy to find jobs ;D

Hence we can assume that even in near future chances of these two languages challenging each other are very minimal.


Editorial Team
editor.theinformatica@gmail.com