Pros and Cons of Nim

Last updated: 29th May 2020 (corrections). See also: discussion on Hacker News.

6 Reasons to Use Nim

Nim is a programming language that has a syntax similar to Python but is compiled to binary code.

See also: Nim Books

1. Friendly Syntax

Nim has a syntax that is similar to Python.

2. High Performance

Nim is much faster than Python (not when comparing C libraries wrapped for Python of course). Nim code compiles first to C then to binaries, with C-like performance always a possibility.

3. Statically Typing

Nim has a statically typed system, unlike Python where types can only be specified optionally. A statically typed language gives better information to the compiler for better optimizations.

4. Managed Memory

Memory leaks are not a concern as Nim uses one of several available garbage collectors. The new ARC option works with reference counting instead of a GC.

5. Package Manager

Nimble is a package manager which makes installing Nim libraries easy.

6. Version 1.0 Milestone

Nim has seen low levels of adoption, but this may be due to version 1.0 taking a long time to be released. Now released in September 2019 Nim has a good foundation for applications and libraries to build on.

Nim has good reasons to use it, but also has some disadvantages. These are likely to improve over the next few years.

See also: Nim Books

4 Disadvantages of using Nim

1. Small Community

Nim has a small following, which means few jobs are available, and the libraries and frameworks for Nim are lacking. C, C++ and Python libraries can be utilized, however, helping to bridge the gap.

2. Better concurrency/parallelism support needed

Nim supports threads, channels and async. However in general concurrency/parallelism needs more work.
Related article: an overview of the current state of Nim’s concurrency/parallelism features.

3. Unhelpful error messages

The Nim compiler often gives unhelpful error messages.

4. Web Frameworks are Lacking

Many languages became popular due to well developed web frameworks (e.g. Ruby has Rails, Elixir has Phoenix and Crystal has Amber, Lucky and others). Nim has Jester which still needs further development and documentation. There is also Karax which is a SPA web framework.

7 replies on “Pros and Cons of Nim”

FYI, you may have confused ‘strong’ and ‘static’ typing. Python is already strongly (if dynamically) typed.

Will continue to nitpick 🙂 (Nice succinct article though by the way – wish people knew more about Nim – it’s great for replacing C for native extensions when speed is an issue)…

I think Cardelli’s claim is meant that yes indeed a static, strongly typed system is so described, but that doesn’t mean that Python doesn’t satisfy the ‘strong’ part when compared to it’s opposite – it will readily complain that `5 + “5”` is an error, where weakly typed systems will give you a variety of behaviors WITHOUT an error, e.g. “55” or 10 or “10” depending on their pathology, and it is this behavior that defines the variance between “strong” and “weak” without treading into the differences between static and dynamic typing (i.e. complier/interpreter-bound contracts regarding the type of a variable). This difference is further diminished by the relatively newly-official type hints that can be used to catch a entire class of errors prior to runtime.

AFAI understood it, Python is generally considered to be a strongly typed language by the community at large, q.v.

Would love more in depth Nim articles! Not enough love being shown for it on HN! 😀 Keep up the good work.

Leave a Reply

Your email address will not be published. Required fields are marked *