index.rst 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. ====
  2. Home
  3. ====
  4. Welcome to Nim
  5. --------------
  6. **Nim** is a statically typed, imperative
  7. programming language that tries to give the programmer ultimate power without
  8. compromises on runtime efficiency. This means it focuses on compile-time
  9. mechanisms in all their various forms.
  10. Beneath a nice infix/indentation based syntax with a
  11. powerful (AST based, hygienic) macro system lies a semantic model that supports
  12. a soft realtime GC on thread local heaps. Asynchronous message passing is used
  13. between threads, so no "stop the world" mechanism is necessary. An unsafe
  14. shared memory heap is also provided for the increased efficiency that results
  15. from that model.
  16. Nim is efficient
  17. ================
  18. * Native code generation (currently via compilation to C), not dependent on a
  19. virtual machine: **Nim produces small executables without dependencies
  20. for easy redistribution.**
  21. * A fast **non-tracing** garbage collector that supports soft
  22. real-time systems (like games).
  23. * System programming features: Ability to manage your own memory and access the
  24. hardware directly. Pointers to garbage collected memory are distinguished
  25. from pointers to manually managed memory.
  26. * Zero-overhead iterators.
  27. * Cross-module inlining.
  28. * Dynamic method binding with inlining and without virtual method table.
  29. * Compile time evaluation of user-defined functions.
  30. * Whole program dead code elimination: Only *used functions* are included in
  31. the executable.
  32. * Value-based datatypes: For instance, objects and arrays can be allocated on
  33. the stack.
  34. Nim is expressive
  35. =================
  36. * **The Nim compiler and all of the standard libraries are implemented in
  37. Nim.**
  38. * Built-in high level datatypes: strings, sets, sequences, etc.
  39. * Modern type system with local type inference, tuples, variants,
  40. generics, etc.
  41. * User-defineable operators; code with new operators is often easier to read
  42. than code which overloads built-in operators. For example, a
  43. ``=~`` operator is defined in the ``re`` module.
  44. * Macros can modify the abstract syntax tree at compile time.
  45. Nim is elegant
  46. ==============
  47. * Macros can use the imperative paradigm to construct parse trees. Nim
  48. does not require a different coding style for meta programming.
  49. * Macros cannot change Nim's syntax because there is no need for it.
  50. Nim's syntax is flexible enough.
  51. * Statements are grouped by indentation but can span multiple lines.
  52. Indentation must not contain tabulators so the compiler always sees
  53. the code the same way as you do.
  54. Nim plays nice with others
  55. ==========================
  56. * The Nim Compiler runs on Windows, Linux, BSD and Mac OS X.
  57. Porting to other platforms is easy.
  58. * **The Nim Compiler can also generate C++ or Objective C for easier
  59. interfacing.**
  60. * There are lots of bindings: for example, bindings to GTK2, the Windows API,
  61. the POSIX API, OpenGL, SDL, Cairo, Python, Lua, TCL, X11, libzip, PCRE,
  62. libcurl, mySQL and SQLite are included in the standard distribution or
  63. can easily be obtained via the
  64. `Nimble package manager <https://github.com/nim-lang/nimble>`_.
  65. * A C to Nim conversion utility: New bindings to C libraries are easily
  66. generated by ``c2nim``.
  67. Roadmap to 1.0
  68. ==============
  69. Please have a look at
  70. this `wiki page <https://github.com/nim-lang/Nim/wiki/Roadmap>`_ for
  71. an up-to-date overview.