-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Unofficial FAQ
If you are looking for the official FAQ then you can find it here
For beginners I suggest to implement missing parts of the standard library or some other more specialized libraries:
- locale support
- a lean GUI library
- libraries for scientific computing
- libraries that deal with multi-media
- etc.
Versions with a trailing odd number are considered to be "in-development", these are unstable "bleeding-edge" versions of the compiler which you can get from Github. Versions with an even number are releases. E.g. 0.9.0 is a release version, 0.9.1 is an in-development version.
Most probably not. Reasons for avoiding them are:
- If proper block comments exist, they should be nestable. This means you cannot tokenize Nim with regular expressions anymore.
- The editor can be used to put "#" in front of every line.
- "when false" is not a bad solution. At least syntax is still checked for deactivated code.
- discard """ """" is another solution.
- Identifiers which only differ in case are bad style. If the programming language treats them the same the programmer needs to come up with different names for different things.
- Case insensitivity is widely considered to be more user friendly. This holds for file systems, configuration files, and programming languages.
- Many programming languages are case insensitive: Lisp, Basic, Pascal, Ada, Eiffel, Fortran. Since software for aircrafts and power plants has been written in Ada, it seems reasonable to assume that case insensitivity will not destroy civilisation.
- Note that most people confuse case sensitivity with case consistency (which is indeed good style). However, case consistency is easier to achieve with case insensitivity and a properly configured IDE than with case sensitivity.
You can find examples in the examples/ directory. There are also many other examples available on Rosetta Code and Nim by Example
- http://critical.eschertech.com/2010/04/07/danger-unsigned-types-used-here/
- http://forum.nim-lang.org/t/313#1631
- http://forum.nim-lang.org/t/892#5303
Tabs are treated differently by different tools and editors. Because indentation is so important in Nim it is much simpler to outright forbid tabs in source code than to risk the mixing of tabs and spaces. Guido van Rossum of Python himself has said that if he were to design Python again he would forbid tabs.
Nim is certainly not unique in forbidding tabs. YAML does the same.
However, if you insist on using tabs in your code, putting this at the top of your code will change the tabs into spaces when compiling #! replace(sub = "\t", by = " ")
If this error looks something like the following:
c_code/nimbase.h:382:13: error: size of array 'assert_numbits' is negative
typedef int assert_numbits[sizeof(NI) == sizeof(void*) && NIM_INTBITS == sizeof
(NI)*8 ? 1 : -1];
Then you are likely trying to compile the C sources with a 64bit version of GCC. If you are trying to do this then you should note that there is a build64.bat
file which you should execute instead of the build.bat
file.
If the error does not resemble the above then the problem is likely with the C sources. Ask for help on IRC or submit an issue on github!
Intro
Getting Started
- Install
- Docs
- Curated Packages
- Editor Support
- Unofficial FAQ
- Nim for C programmers
- Nim for Python programmers
- Nim for TypeScript programmers
- Nim for D programmers
- Nim for Java programmers
- Nim for Haskell programmers
Developing
- Build
- Contribute
- Creating a release
- Compiler module reference
- Consts defined by the compiler
- Debugging the compiler
- GitHub Actions/Travis CI/Circle CI/Appveyor
- GitLab CI setup
- Standard library and the JavaScript backend
Misc