diff options
author | Araq <rumpf_a@web.de> | 2012-11-26 08:47:57 +0100 |
---|---|---|
committer | Araq <rumpf_a@web.de> | 2012-11-26 08:47:57 +0100 |
commit | 2591ac0ada7f022b695b91f8ce9e5cfe1e7df299 (patch) | |
tree | a7543d5861638f15c75fce9758318ce78cb9c82e /doc | |
parent | dd9ad9e49730cec954e9113f0136053c5020aafd (diff) | |
download | Nim-2591ac0ada7f022b695b91f8ce9e5cfe1e7df299.tar.gz |
'return' for first class iterators
Diffstat (limited to 'doc')
-rwxr-xr-x | doc/manual.txt | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/doc/manual.txt b/doc/manual.txt index c97e4ef5c..f6ff576bf 100755 --- a/doc/manual.txt +++ b/doc/manual.txt @@ -1199,6 +1199,31 @@ details like this when mixing garbage collected data with unmanaged memory. .. XXX finalizers for traced objects +Not nil annotation +~~~~~~~~~~~~~~~~~~ + +All types for that ``nil`` is a valid value can be annotated to +exclude ``nil`` as a valid value with the `not nil`:idx: annotation: + +.. code-block:: nimrod + type + PObject = ref TObj not nil + TProc = (proc (x, y: int)) not nil + + proc p(x: PObject) = + echo "not nil" + + # compiler catches this: + p(nil) + + # but not this: + var x: PObject + p(x) + +As shown in the example this is merely an annotation for documentation purposes; +for now the compiler can only catch the most trivial type violations. + + Procedural type ~~~~~~~~~~~~~~~ A `procedural type`:idx: is internally a pointer to a procedure. ``nil`` is |