Skip to content

Commit

Permalink
Merge pull request nim-lang#1967 from def-/more-renames
Browse files Browse the repository at this point in the history
More renames
  • Loading branch information
Varriount committed Jan 17, 2015
2 parents 6234298 + aae3c6c commit b828bae
Show file tree
Hide file tree
Showing 25 changed files with 237 additions and 237 deletions.
10 changes: 5 additions & 5 deletions doc/docgen.txt
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,13 @@ documentation with only their well-documented code.
Example:

.. code-block:: nim
type TPerson* = object
type Person* = object
## This type contains a description of a person
name: string
age: int

Outputs::
TPerson* = object
Person* = object
name: string
age: int

Expand Down Expand Up @@ -268,8 +268,8 @@ The relationship of type to suffix is made by the proc ``complexName`` in the
``compiler/docgen.nim`` file. Here are some examples of complex names for
symbols in the `system module <system.html>`_.

* ``type TSignedInt = int | int8 | int16 | int32 | int64`` **=>**
`#TSignedInt <system.html#TSignedInt>`_
* ``type SignedInt = int | int8 | int16 | int32 | int64`` **=>**
`#SignedInt <system.html#SignedInt>`_
* ``var globalRaiseHook: proc (e: ref E_Base): bool {.nimcall.}`` **=>**
`#globalRaiseHook <system.html#globalRaiseHook>`_
* ``const NimVersion = "0.0.0"`` **=>**
Expand Down Expand Up @@ -307,7 +307,7 @@ columns is:
Nim's rules (eg. \`^\` like in `the actors module
<actors.html#^,ptr.TChannel[T]>`_).
2. Base filename plus anchor hyper link (eg.
``algorithm.html#*,int,TSortOrder``).
``algorithm.html#*,int,SortOrder``).
3. Optional human readable string to display as hyper link. If the value is not
present or is the empty string, the hyper link will be rendered
using the term. Prefix whitespace indicates that this entry is
Expand Down
2 changes: 1 addition & 1 deletion doc/filters.txt
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ The template engine is quite flexible. It is easy to produce a procedure that
writes the template code directly to a file::

#! stdtmpl(emit="f.write") | standard
#proc writeHTMLPage(f: TFile, title, currentTab, content: string,
#proc writeHTMLPage(f: File, title, currentTab, content: string,
# tabs: openArray[string]) =
<head><title>$title</title></head>
<body>
Expand Down
20 changes: 10 additions & 10 deletions doc/idetools.txt
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ tab characters (``\t``). The values of each column are:
``proj.symbolName``.
4. Type/signature. For variables and enums this will contain the
type of the symbol, for procs, methods and templates this will
contain the full unique signature (e.g. ``proc (TFile)``).
contain the full unique signature (e.g. ``proc (File)``).
5. Full path to the file containing the symbol.
6. Line where the symbol is located in the file. Lines start to
count at **1**.
Expand Down Expand Up @@ -258,8 +258,8 @@ skEnumField

.. code-block:: nim
Open(filename, fmWrite)
--> col 2: system.TFileMode.fmWrite
col 3: TFileMode
--> col 2: system.FileMode.fmWrite
col 3: FileMode
col 7: ""


Expand Down Expand Up @@ -296,7 +296,7 @@ posterior instances of the iterator.
text = "some text"
letters = toSeq(runes(text))
--> col 2: unicode.runes
col 3: iterator (string): TRune
col 3: iterator (string): Rune
col 7: "iterates over any unicode character of the string `s`."


Expand Down Expand Up @@ -423,7 +423,7 @@ returned by idetools returns also the pragmas for the proc.
.. code-block:: nim
Open(filename, fmWrite)
--> col 2: system.Open
col 3: proc (var TFile, string, TFileMode, int): bool
col 3: proc (var File, string, FileMode, int): bool
col 7:
"Opens a file named `filename` with given `mode`.

Expand Down Expand Up @@ -487,9 +487,9 @@ skType

.. code-block:: nim
proc writeTempFile() =
var output: TFile
--> col 2: system.TFile
col 3: TFile
var output: File
--> col 2: system.File
col 3: File
col 7: ""


Expand All @@ -502,11 +502,11 @@ skVar

.. code-block:: nim
proc writeTempFile() =
var output: TFile
var output: File
output.open("/tmp/somefile", fmWrite)
output.write("test")
--> col 2: $MODULE.writeTempFile.output
col 3: TFile
col 3: File
col 7: ""


Expand Down
4 changes: 2 additions & 2 deletions doc/manual/effects.txt
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@ compatibility:

.. code-block:: nim
type
TCallback = proc (s: string) {.raises: [IOError].}
Callback = proc (s: string) {.raises: [IOError].}
var
c: TCallback
c: Callback

proc p(x: string) =
raise newException(OSError, "OS")
Expand Down
2 changes: 1 addition & 1 deletion doc/manual/ffi.txt
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ instructs the compiler to pass the type by value to procs:

.. code-block:: nim
type
TVector {.bycopy, pure.} = object
Vector {.bycopy, pure.} = object
x, y, z: float


Expand Down
44 changes: 22 additions & 22 deletions doc/manual/generics.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,17 @@ The following example shows a generic binary tree can be modelled:

.. code-block:: nim
type
TBinaryTree[T] = object # TBinaryTree is a generic type with
BinaryTreeObj[T] = object # BinaryTreeObj is a generic type with
# with generic param ``T``
le, ri: ref TBinaryTree[T] # left and right subtrees; may be nil
le, ri: BinaryTree[T] # left and right subtrees; may be nil
data: T # the data stored in a node
PBinaryTree[T] = ref TBinaryTree[T] # a shorthand for notational convenience
BinaryTree[T] = ref BinaryTreeObj[T] # a shorthand for notational convenience

proc newNode[T](data: T): PBinaryTree[T] = # constructor for a node
proc newNode[T](data: T): BinaryTree[T] = # constructor for a node
new(result)
result.data = data

proc add[T](root: var PBinaryTree[T], n: PBinaryTree[T]) =
proc add[T](root: var BinaryTree[T], n: BinaryTree[T]) =
if root == nil:
root = n
else:
Expand All @@ -40,7 +40,7 @@ The following example shows a generic binary tree can be modelled:
return
it = it.ri

iterator inorder[T](root: PBinaryTree[T]): T =
iterator inorder[T](root: BinaryTree[T]): T =
# inorder traversal of a binary tree
# recursive iterators are not yet implemented, so this does not work in
# the current compiler!
Expand All @@ -49,7 +49,7 @@ The following example shows a generic binary tree can be modelled:
if root.ri != nil: yield inorder(root.ri)

var
root: PBinaryTree[string] # instantiate a PBinaryTree with the type string
root: BinaryTree[string] # instantiate a BinaryTree with the type string
add(root, newNode("hallo")) # instantiates generic procs ``newNode`` and
add(root, newNode("world")) # ``add``
for str in inorder(root):
Expand All @@ -64,10 +64,10 @@ therefore very useful for type specialization within generic code:

.. code-block:: nim
type
TTable[TKey, TValue] = object
keys: seq[TKey]
values: seq[TValue]
when not (TKey is string): # nil value for strings used for optimization
Table[Key, Value] = object
keys: seq[Key]
values: seq[Value]
when not (Key is string): # nil value for strings used for optimization
deletedKeys: seq[bool]


Expand Down Expand Up @@ -127,9 +127,9 @@ more complex type classes:

.. code-block:: nim
# create a type class that will match all tuple and object types
type TRecordType = tuple or object
type RecordType = tuple or object

proc printFields(rec: TRecordType) =
proc printFields(rec: RecordType) =
for key, value in fieldPairs(rec):
echo key, " = ", value

Expand Down Expand Up @@ -175,11 +175,11 @@ type parameters of the matched generic type. They can be easily accessed using
the dot syntax:

.. code-block:: nim
type TMatrix[T, Rows, Columns] = object
type Matrix[T, Rows, Columns] = object
...

proc `[]`(m: TMatrix, row, col: int): TMatrix.T =
m.data[col * high(TMatrix.Columns) + row]
proc `[]`(m: Matrix, row, col: int): Matrix.T =
m.data[col * high(Matrix.Columns) + row]

Alternatively, the `type` operator can be used over the proc params for similar
effect when anonymous or distinct type classes are used.
Expand All @@ -195,7 +195,7 @@ type, this results in another more specific type class:
# seq[T1] is the same as just `seq`, but T1 will be allowed to bind
# to a single type, while the signature is being matched

TMatrix[Ordinal] # Any TMatrix instantiation using integer values
Matrix[Ordinal] # Any Matrix instantiation using integer values

As seen in the previous example, in such instantiations, it's not necessary to
supply all type parameters of the generic type, because any missing ones will
Expand Down Expand Up @@ -292,18 +292,18 @@ at definition and the context at instantiation are considered:

.. code-block:: nim
type
TIndex = distinct int
Index = distinct int

proc `==` (a, b: TIndex): bool {.borrow.}
proc `==` (a, b: Index): bool {.borrow.}

var a = (0, 0.TIndex)
var b = (0, 0.TIndex)
var a = (0, 0.Index)
var b = (0, 0.Index)

echo a == b # works!

In the example the generic ``==`` for tuples (as defined in the system module)
uses the ``==`` operators of the tuple's components. However, the ``==`` for
the ``TIndex`` type is defined *after* the ``==`` for tuples; yet the example
the ``Index`` type is defined *after* the ``==`` for tuples; yet the example
compiles as the instantiation takes the currently defined symbols into account
too.

Expand Down
4 changes: 2 additions & 2 deletions doc/manual/lexing.txt
Original file line number Diff line number Diff line change
Expand Up @@ -261,9 +261,9 @@ A character is not an Unicode character but a single byte. The reason for this
is efficiency: for the overwhelming majority of use-cases, the resulting
programs will still handle UTF-8 properly as UTF-8 was specially designed for
this. Another reason is that Nim can thus support ``array[char, int]`` or
``set[char]`` efficiently as many algorithms rely on this feature. The `TRune`
``set[char]`` efficiently as many algorithms rely on this feature. The `Rune`
type is used for Unicode characters, it can represent any Unicode character.
``TRune`` is declared in the `unicode module <unicode.html>`_.
``Rune`` is declared in the `unicode module <unicode.html>`_.


Numerical constants
Expand Down
10 changes: 5 additions & 5 deletions doc/manual/modules.txt
Original file line number Diff line number Diff line change
Expand Up @@ -128,22 +128,22 @@ modules don't need to import a module's dependencies:

.. code-block:: nim
# module B
type TMyObject* = object
type MyObject* = object

.. code-block:: nim
# module A
import B
export B.TMyObject
export B.MyObject

proc `$`*(x: TMyObject): string = "my object"
proc `$`*(x: MyObject): string = "my object"


.. code-block:: nim
# module C
import A

# B.TMyObject has been imported implicitly here:
var x: TMyObject
# B.MyObject has been imported implicitly here:
var x: MyObject
echo($x)


Expand Down
22 changes: 11 additions & 11 deletions doc/manual/pragmas.txt
Original file line number Diff line number Diff line change
Expand Up @@ -89,12 +89,12 @@ collector to not consider objects of this type as part of a cycle:

.. code-block:: nim
type
PNode = ref TNode
TNode {.acyclic, final.} = object
left, right: PNode
Node = ref NodeObj
NodeObj {.acyclic, final.} = object
left, right: Node
data: string

In the example a tree structure is declared with the ``TNode`` type. Note that
In the example a tree structure is declared with the ``Node`` type. Note that
the type definition is recursive and the GC has to assume that objects of
this type may form a cyclic graph. The ``acyclic`` pragma passes the
information that this cannot happen to the GC. If the programmer uses the
Expand All @@ -106,9 +106,9 @@ memory, but nothing worse happens.

.. code-block:: nim
type
PNode = acyclic ref TNode
TNode = object
left, right: PNode
Node = acyclic ref NodeObj
NodeObj = object
left, right: Node
data: string


Expand All @@ -129,13 +129,13 @@ structure:

.. code-block:: nim
type
TNodeKind = enum nkLeaf, nkInner
TNode {.final, shallow.} = object
case kind: TNodeKind
NodeKind = enum nkLeaf, nkInner
Node {.final, shallow.} = object
case kind: NodeKind
of nkLeaf:
strVal: string
of nkInner:
children: seq[TNode]
children: seq[Node]


pure pragma
Expand Down
8 changes: 4 additions & 4 deletions doc/manual/procs.txt
Original file line number Diff line number Diff line change
Expand Up @@ -121,21 +121,21 @@ different; for this a special setter syntax is needed:
.. code-block:: nim

type
TSocket* = object of TObject
Socket* = object of RootObj
FHost: int # cannot be accessed from the outside of the module
# the `F` prefix is a convention to avoid clashes since
# the accessors are named `host`

proc `host=`*(s: var TSocket, value: int) {.inline.} =
proc `host=`*(s: var Socket, value: int) {.inline.} =
## setter of hostAddr
s.FHost = value

proc host*(s: TSocket): int {.inline.} =
proc host*(s: Socket): int {.inline.} =
## getter of hostAddr
s.FHost

var
s: TSocket
s: Socket
s.host = 34 # same as `host=`(s, 34)


Expand Down
4 changes: 2 additions & 2 deletions doc/manual/stmts.txt
Original file line number Diff line number Diff line change
Expand Up @@ -118,11 +118,11 @@ initialized and does not rely on syntactic properties:

.. code-block:: nim
type
TMyObject = object {.requiresInit.}
MyObject = object {.requiresInit.}

proc p() =
# the following is valid:
var x: TMyObject
var x: MyObject
if someCondition():
x = a()
else:
Expand Down
Loading

0 comments on commit b828bae

Please sign in to comment.