summary refs log tree commit diff stats
path: root/doc/astspec.txt
Commit message (Expand)AuthorAgeFilesLines
* unify tuple expressions (#13793)Arne Döring2021-03-301-4/+41
* nnkArglist => nnkArgList + special case stylecheck:error (#17529)Timothee Cour2021-03-271-1/+1
* fix docs typo (#16637)flywind2021-01-121-1/+1
* fix syntax in macros documentation (#16604)n5m2021-01-061-1/+1
* Add docs for nnkHiddenStdConv (#16408)treeform2020-12-271-0/+11
* Fix proc generic params ident defs, missing empty (#15412)hlaaftana2020-09-271-1/+3
* Fix(astspec.txt): type of repeated word (#14612)ynfle2020-06-081-1/+1
* Prefer relative links for Nim documentationJjp1372019-10-221-3/+3
* Fix many broken linksJjp1372019-10-221-1/+1
* Fixed a wrong AST example (#8269)Quelklef2018-07-111-4/+4
* Get symbol kind (#7491)Arne Döring2018-04-111-91/+87
* Ast and concrete syntax different.Strømberg2018-01-081-1/+1
* Creating and setting comment nodes in macros (#5850)Fredrik Høisæther Rasch2017-05-311-2/+2
* Fix a table in macros documentationDmitry Polienko2016-10-191-0/+1
* NimSymbol has been renamed to NimSymdef2016-06-061-1/+1
* doc fixYuriy Glukhov2015-11-231-3/+5
* Merge pull request #3000 from apense/patch-6Andreas Rumpf2015-06-261-2/+3
|\
| * Clarified nnkFloat64Litapense2015-06-261-2/+3
* | Updated nnkRange docsapense2015-06-261-1/+29
|/
* rename writeln to writeLine in docpatrick dw2015-06-191-2/+2
* Minor fixes to astspecapense2015-06-181-37/+38
* Merge pull request #2954 from avsej/fix-rest-syntax-in-astspecAndreas Rumpf2015-06-181-59/+59
|\
| * Fix reST syntax in doc/astspec.txtSergey Avseyev2015-06-181-3/+3
| * Remove trailing spaces in doc/astspec.txtSergey Avseyev2015-06-181-57/+57
* | More documentation of ASTapense2015-06-171-1/+95
|/
* Added uints to Leaf nodesapense2015-06-161-0/+4
* Fleshed out type sectionapense2015-06-151-2/+103
* Added import-type statementsapense2015-06-151-0/+96
* Minor updates; addition of `var` return in procsapense2015-06-151-0/+48
* Added static typesapense2015-06-151-0/+20
* Added raw string literal function calls docsapense2015-06-151-0/+19
* Corrected capitalizationapense2015-06-151-1/+1
* Updated type section a littleapense2015-06-151-0/+44
* Clarified ASTapense2015-06-151-4/+4
* Added some documentationapense2015-06-151-16/+391
* Update ast spec about uint literalsdef2015-05-181-1/+1
* macros.PNimrodNode is now NimNodeAraq2015-02-241-18/+14
* Nimrod renamed to NimAraq2014-08-281-56/+56
* Removes executable bit for text files.Grzegorz Adam Hankiewicz2013-03-161-0/+0
* non-nil AST; continue after errors for IDE supportAraq2011-02-121-5/+3
* fixed pango/pangoutils new wrappersAndreas Rumpf2010-02-261-0/+0
* continued work on html/xmlparserrumpf_a@web.de2010-02-141-0/+0
* bind tableAndreas Rumpf2009-11-121-3/+9
* added tools and web dirsAndreas Rumpf2009-09-151-0/+0
* version0.7.10Andreas Rumpf2009-06-081-0/+572
b7ec263dfb8c07748'>66a7e3d37 ^
2c91e999e ^
74fdd5c2e ^

3c0a6a896 ^
66a7e3d37 ^
74fdd5c2e ^
66a7e3d37 ^
74fdd5c2e ^

66a7e3d37 ^
74fdd5c2e ^


66a7e3d37 ^
eca05d2a3 ^
74fdd5c2e ^
eca05d2a3 ^
74fdd5c2e ^

d10973adb ^
74fdd5c2e ^
2c91e999e ^
74fdd5c2e ^

d10973adb ^
e3c313048 ^
74fdd5c2e ^
d10973adb ^
74fdd5c2e ^

2c91e999e ^
74fdd5c2e ^
2c91e999e ^
74fdd5c2e ^
f9641790b ^
f9641790b ^
74fdd5c2e ^




e2d820689 ^

61d9f55fa ^
74fdd5c2e ^






2a7a5a69d ^
70d1e14ad ^
74fdd5c2e ^

70d1e14ad ^
74fdd5c2e ^
e26846d0a ^
2f7d24809 ^
2c91e999e ^
ac756935c ^
74fdd5c2e ^







50e156db6 ^

30cc35383 ^

f9641790b ^

73fbcc1f6 ^

66a7e3d37 ^
74fdd5c2e ^



d10973adb ^
74fdd5c2e ^
d10973adb ^
74fdd5c2e ^
d10973adb ^
74fdd5c2e ^

d10973adb ^
74fdd5c2e ^
d10973adb ^
74fdd5c2e ^
d10973adb ^
74fdd5c2e ^

66a7e3d37 ^
8b807adc0 ^
74fdd5c2e ^
66a7e3d37 ^
73fbcc1f6 ^









66a7e3d37 ^
74fdd5c2e ^
9ee59da41 ^
74fdd5c2e ^


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192




                                           

           
 
 
                       
 

              
 



                                                                                




                                                                                 
                  
 




















                                                                                
 
                       
 

                                       
 

                                                                           
                         
 
 
                       
 

                                                               
 

                                                                                
 
 
                       
 

                                    
 

                                                                          

                                                                               
 
                                                                   

                                                                        
 
 
                       
 

                      
 


                                                                              
 
 
                       
 

                    
 
                                                                               
                                                                             

                                                                                 
 
 
                       
 

                  
                                                                            
                                                                                
                                                                 
                                      
 
 




                              

                                                                                         
                                                                   






                            
                                               
                                                  

                                           
                                                                                                                                    
                                                                
                                                                                                      
                                                                                                      
                                                             
                  







                                                                              

                                                                              

                                                                              

 

               
 



                                                 
 
                                                                     
 
                       
 

                                                  
 
                                                                              
 
                       
 

                                                           
 
                                   
                                                                  
 









                                                                
 
                                                                     
 


                                                                                
===========================================
         Questions and Answers
===========================================


General FAQ
===========


.. container:: standout

  What is Nim?
  ------------

  Nim (formerly known as "Nimrod") is a statically typed, imperative programming
  language that tries to give the programmer ultimate power without compromises
  on runtime efficiency.
  This means it focuses on compile-time mechanisms in all their
  various forms. Beneath a nice infix/indentation based syntax with a
  powerful (AST based, hygienic) macro system lies a semantic model that supports
  a soft realtime GC on thread local heaps. Asynchronous message passing is used
  between threads, so no "stop the world" mechanism is necessary. An unsafe
  shared memory heap is also provided for the increased efficiency that results
  from that model.

..

  .. container:: standout

    Why should I use Nim?
    ---------------------

    It's a conservative language in a sense that we stick to features that have
    proven themselves for larger scale programming. But it's revolutionary by
    the features which have been laid on top.

    One of Nim's goals is to increase developer productivity without sacrificing
    the produced software's stability. The way that this is done is by providing

    Depending on your use case.

    Nim is one of the few programming languages in the world which allows you to


    The language inventor describes it as the ultimate programming language
    with features which make it perfect for just about any problem.

.. container:: standout

  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.


.. container:: standout

  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.


.. container:: standout

  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.


.. container:: standout

  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.


.. container:: standout

  How stable is 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.


.. container:: standout

  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.


.. container:: standout

  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 transparenlty generate all the
  glue code thanks to powerful metaprogramming capabilities of Nim.


.. container:: standout

  What about editor support?
  --------------------------

  - Nim IDE: https://github.com/nim-lang/Aporia
  - Emacs: https://github.com/reactormonk/nim-mode
  - Vim: https://github.com/zah/nimrod.vim/
  - Scite: Included
  - Gedit: The `Aporia .lang file <https://github.com/nim-lang/Aporia/blob/master/share/gtksourceview-2.0/language-specs/nim.lang>`_
  - jEdit: https://github.com/exhu/nimrod-misc/tree/master/jedit
  - TextMate: Available in bundle installer (`Repository <https://github.com/textmate/nim.tmbundle>`_)
  - Sublime Text: Available via Package Control (`Repository <https://github.com/Varriount/NimLime>`_)
  - LiClipse: http://www.liclipse.com/ (Eclipse based plugin)
  - Howl: Included


.. container:: standout

  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 a
  ``iterator`` and ``method`` keywords, whereas ``def`` stands for ``define``.


Compilation FAQ
===============

.. container:: standout

  Which option to use for the fastest executable?
  -----------------------------------------------

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

.. container:: standout

  Which option to use for the smallest executable?
  ------------------------------------------------

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

.. container:: standout

  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.