summary refs log tree commit diff stats
path: root/lib/pure/osproc.nim
diff options
context:
space:
mode:
authorAraq <rumpf_a@web.de>2014-10-03 01:21:35 +0200
committerAraq <rumpf_a@web.de>2014-10-03 01:21:35 +0200
commite65c296bcca4bf0f690e026374c900e33e885a93 (patch)
treebbea3749d7f651a2b1c4e982b84adc8beb095ef3 /lib/pure/osproc.nim
parent595cc93762397ad6948a3b14298fe23a00b89667 (diff)
downloadNim-e65c296bcca4bf0f690e026374c900e33e885a93.tar.gz
implemented mixed mode codegen
Diffstat (limited to 'lib/pure/osproc.nim')
0 files changed, 0 insertions, 0 deletions
'author Timothee Cour <timothee.cour2@gmail.com> 2019-02-05 17:19:29 -0800 committer Timothee Cour <timothee.cour2@gmail.com> 2019-02-05 17:19:29 -0800 [doc] lots of fixes in doc/contributing.rst and doc/docstyle.rst' href='/ahoang/Nim/commit/doc/docstyle.rst?h=devel&id=86f4dae74831125bb0b9fae6f59b480169a0b52f'>86f4dae74 ^
5e9dd81ba ^
86f4dae74 ^

a98f609ae ^




86f4dae74 ^
a98f609ae ^



86f4dae74 ^
a98f609ae ^
f7a0a42b0 ^
86f4dae74 ^
a98f609ae ^
















86f4dae74 ^
a98f609ae ^



86f4dae74 ^
a98f609ae ^






86f4dae74 ^
c701ed3c9 ^
a98f609ae ^
f7a0a42b0 ^
86f4dae74 ^





a98f609ae ^

13b1b19a8 ^
a98f609ae ^









a48cbfe56 ^
a98f609ae ^












a48cbfe56 ^
a98f609ae ^









86f4dae74 ^
a98f609ae ^














a48cbfe56 ^
a98f609ae ^



a48cbfe56 ^
a98f609ae ^









a48cbfe56 ^
a98f609ae ^









a48cbfe56 ^
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





                   
                                                                                                  

                                                                              


                                                                                                                    
                                                                                           



                                                                                                                   



                                       
                                                                           

                                                                           




                                                                                                                                   
                                                                                               



                                                                      
                                                                                     
    
                    
                                          
















                                                                                                                                               
                                                                                                                                                                                        



                          
                               






                                                                                                                                  
                                                              
                             
      
                      





                                                                                

                        
                                                                                                   









                                                                                                                                                               
                                                                                  












                                                                          
                                                            









                                                                 
                                                                                   














                                                                                                                                                
                                 



                    
                                         









                                                                                                                                                                        
                                         









                                                                                  
                                                         
Documentation Style
===================

General Guidelines
------------------

* See also `nep1<https://nim-lang.github.io/Nim/nep1.html>`_ which should probably be merged here.
* Authors should document anything that is exported; documentation for private
  procs can be useful too (visible via ``nim doc --docInternal foo.nim``).
* Within documentation, a period (`.`) should follow each sentence (or sentence fragment) in a comment block.
  The documentation may be limited to one sentence fragment, but if multiple sentences are within the documentation,
  each sentence after the first should be complete and in present tense.
* Documentation is parsed as a custom ReStructuredText (RST) with partial markdown support.
* In nim sources, prefer single backticks to double backticks since it's simpler
  and `nim doc` supports it (even in rst files with `nim rst2html`).
* In nim sources, for links, prefer `[link text](link.html)` to ``` `link text<link.html>`_ ```
  since the syntax is simpler and markdown is more common (likewise, `nim rst2html` also supports it in rst files).

.. code-block:: nim

  proc someproc*(s: string, foo: int) =
    ## Use single backticks for inline code, e.g.: `s` or `someExpr(true)`.
    ## Use a backlash to follow with alphanumeric char: `int8`\s are great.


Module-level documentation
--------------------------

Documentation of a module is placed at the top of the module itself. Each line of documentation begins with double hashes (``##``).
Sometimes ``##[ multiline docs containing code ]##`` is preferable, see ``lib/pure/times.nim``.
Code samples are encouraged, and should follow the general RST syntax:

.. code-block:: Nim

  ## The `universe` module computes the answer to life, the universe, and everything.
  ##
  ## .. code-block::
  ##  doAssert computeAnswerString() == 42


Within this top-level comment, you can indicate the authorship and copyright of the code, which will be featured in the produced documentation.

.. code-block:: Nim

  ## This is the best module ever. It provides answers to everything!
  ##
  ## :Author: Steve McQueen
  ## :Copyright: 1965
  ##

Leave a space between the last line of top-level documentation and the beginning of Nim code (the imports, etc.).

Procs, Templates, Macros, Converters, and Iterators
---------------------------------------------------

The documentation of a procedure should begin with a capital letter and should be in present tense. Variables referenced in the documentation should be surrounded by single tick marks:

.. code-block:: Nim

  proc example1*(x: int) =
    ## Prints the value of `x`.
    echo x

Whenever an example of usage would be helpful to the user, you should include one within the documentation in RST format as below.

.. code-block:: Nim

  proc addThree*(x, y, z: int8): int =
    ## Adds three `int8` values, treating them as unsigned and
    ## truncating the result.
    ##
    ## .. code-block::
    ##  # things that aren't suitable for a `runnableExamples` go in code-block:
    ##  echo execCmdEx("git pull")
    ##  drawOnScreen()
    runnableExamples:
      # `runnableExamples` is usually preferred to `code-block`, when possible.
      doAssert addThree(3, 125, 6) == -122
    result = x +% y +% z

The command ``nim doc`` will then correctly syntax highlight the Nim code within the documentation.

Types
-----

Exported types should also be documented. This documentation can also contain code samples, but those are better placed with the functions to which they refer.

.. code-block:: Nim

  type
    NamedQueue*[T] = object ## Provides a linked data structure with names
                            ## throughout. It is named for convenience. I'm making
                            ## this comment long to show how you can, too.
      name*: string ## The name of the item
      val*: T ## Its value
      next*: ref NamedQueue[T] ## The next item in the queue


You have some flexibility when placing the documentation:

.. code-block:: Nim

  type
    NamedQueue*[T] = object
      ## Provides a linked data structure with names
      ## throughout. It is named for convenience. I'm making
      ## this comment long to show how you can, too.
      name*: string ## The name of the item
      val*: T ## Its value
      next*: ref NamedQueue[T] ## The next item in the queue

Make sure to place the documentation beside or within the object.

.. code-block:: Nim

  type
    ## Bad: this documentation disappears because it annotates the ``type`` keyword
    ## above, not ``NamedQueue``.
    NamedQueue*[T] = object
      name*: string ## This becomes the main documentation for the object, which
                    ## is not what we want.
      val*: T ## Its value
      next*: ref NamedQueue[T] ## The next item in the queue

Var, Let, and Const
-------------------

When declaring module-wide constants and values, documentation is encouraged. The placement of doc comments is similar to the ``type`` sections.

.. code-block:: Nim

  const
    X* = 42 ## An awesome number.
    SpreadArray* = [
      [1,2,3],
      [2,3,1],
      [3,1,2],
    ] ## Doc comment for ``SpreadArray``.

Placement of comments in other areas is usually allowed, but will not become part of the documentation output and should therefore be prefaced by a single hash (``#``).

.. code-block:: Nim

  const
    BadMathVals* = [
      3.14, # pi
      2.72, # e
      0.58, # gamma
    ] ## A bunch of badly rounded values.

Nim supports Unicode in comments, so the above can be replaced with the following:

.. code-block:: Nim

  const
    BadMathVals* = [
      3.14, # π
      2.72, # e
      0.58, # γ
    ] ## A bunch of badly rounded values (including π!).