Fork me on GitHub

Frequently Asked Questions

General questions

Why yet another programming language?

Nim is one of the very few programmable statically typed languages, and one of the even fewer that produces native binaries that require no runtime or interpreter.

What have been the major influences in the language’s design?

The language borrows heavily from (in order of impact): Modula 3, Delphi, Ada, C++, Python, Lisp, Oberon.

What is Nim’s take on concurrency?

Nim primarily focusses on thread local (and garbage collected) heaps and message passing between threads. Each thread has its own GC, so no “stop the world” mechanism is necessary. An unsafe shared memory heap is also provided.

Future versions will additionally include a GC “per thread group” and Nim’s type system will be enhanced to accurately model this shared memory heap.

How is Nim licensed?

The Nim compiler and the library are MIT licensed. This means that you can use any license for your own programs developed with Nim.

How stable is Nim?

The compiler and stdlib are actively under development and have a suite of test cases to ensure ongoing stability. Regular releases are posted every three to six months that can be used as a base for projects requiring a stable foundation. Breaking changes are rare but are documented in detail and can typically be managed with minimal effort. The compiler also highlights deprecated methods to provide sufficient notice and transition time through changes.

How fast is Nim?

Benchmarks show it to be comparable to C. Some language features (methods, closures, message passing) are not yet as optimized as they could and will be. The only overhead Nim has over C is the GC which has been tuned for years but still needs some work.

What about JVM/CLR backends?

JVM/CLR support is not in the nearest plans. However, since these VMs support FFI to C it should be possible to create native Nim bridges, that transparently generate all the glue code thanks to powerful metaprogramming capabilities of Nim.

What about editor support?

Why is it named proc?

Procedure used to be the common term as opposed to a function which is a mathematical entity that has no side effects. It is planned to have func as syntactic sugar for proc {.noSideEffect.} and func is already a keyword. Naming it def would not make sense because Nim also provides an iterator and a method keyword, whereas def stands for define.

Compilation FAQ

Which option to use for the fastest executable?

For the standard configuration file, -d:release does the trick.

Which option to use for the smallest executable?

For the standard configuration file, -d:quick --opt:size does the trick.

How do I use a different C compiler than the default one?

Edit the config/nim.cfg file. Change the value of the cc variable to one of the following:

Abbreviation C/C++ Compiler
vcc Microsoft’s Visual C++
gcc Gnu C
llvm_gcc LLVM-GCC compiler
icc Intel C compiler
clang Clang compiler
ucc Generic UNIX C compiler

Other C compilers are not officially supported, but might work too.

If your C compiler is not in the above list, try using the generic UNIX C compiler (ucc). If the C compiler needs different command line arguments try the --passc and --passl switches.