This article is written for Nim v1.2.
A lack of libraries
Nim doesn’t have the large selection of libraries that C/C++ and Python have, but you can use libraries from those languages in Nim.
Projects that help at a high-level to make this easier:
- For C/C++ libraries use nimterop.
- For Python modules use nimpy (also included in nimporter).
Limited code error messages
Nim’s error messages for invalid code can be limited/misleading. This is because the compiler reports on the immediate problem, often at a low-level, without hinting at the actual cause.
- Not including a standard module when using its features: for example the tables or options module, but using tables or options in your code.
- Not making a function public when calling it from another module: currently the compiler gives an ‘undeclared identifier’ error.
- Not making a field public when calling it from another module: currently the compiler gives an ‘undeclared field’ error.
- Not using get() when trying to get the value of an optional field of an object: current the compiler gives an ‘undeclared field’ error if you leave out the get() call.
Limited compiler error messages
- On many Linux or Mac environments the current directory (.) is not in the path. Nim expects the current directory to be in the path or you can’t easily include your modules in your project (unless you use relative paths). This can be corrected by adding the the current directory to the path when calling the compiler. Use -p:. or –path:. when calling nim c.
See also: Nim Books