summary refs log tree commit diff stats
path: root/doc/manual.txt
diff options
context:
space:
mode:
authorAraq <rumpf_a@web.de>2014-03-26 08:42:27 +0100
committerAraq <rumpf_a@web.de>2014-03-26 08:42:27 +0100
commit7874c0efcb2437c378c973a51de88f3ebc7e4d74 (patch)
treecdbb292f655b3246df7731f17ce5484bdf19a93c /doc/manual.txt
parentcdb4d83eadef07c3ba07b1a2d408548df1b3326b (diff)
downloadNim-7874c0efcb2437c378c973a51de88f3ebc7e4d74.tar.gz
borrow dots for distinct types documented
Diffstat (limited to 'doc/manual.txt')
-rw-r--r--doc/manual.txt22
1 files changed, 22 insertions, 0 deletions
diff --git a/doc/manual.txt b/doc/manual.txt
index c2acd3e6a..6526ba2cb 100644
--- a/doc/manual.txt
+++ b/doc/manual.txt
@@ -1569,6 +1569,28 @@ currency. This can be solved with templates_.
   defineCurrency(TEuro, int)
 
 
+The borrow pragma can also be used to annotate the distinct type to allow
+certain builtin operations to be lifted:
+
+.. code-block:: nimrod
+  type
+    Foo = object
+      a, b: int
+      s: string
+
+    Bar {.borrow: `.`.} = distinct Foo
+
+  var bb: ref Bar
+  new bb
+  # field access now valid
+  bb.a = 90
+  bb.s = "abc"
+
+Currently only the dot accessor can be borrowed in this way.
+
+
+
+
 Void type
 ---------