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.
The language borrows heavily from (in order of impact): Modula 3, Delphi, Ada, C++, Python, Lisp, Oberon.
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.
The Nim compiler and the library are MIT licensed. This means that you can use any license for your own programs developed with Nim.
The compiler is in development and some important features are still missing. However, the compiler is quite stable already: It is able to compile itself and a substantial body of other code. Until version 1.0.0 is released, minor incompatibilities with older versions of the compiler will be introduced.
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.
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.
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
.
For the standard configuration file, -d:release
does the trick.
For the standard configuration file, -d:quick --opt:size
does the trick.
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.