From 7874c0efcb2437c378c973a51de88f3ebc7e4d74 Mon Sep 17 00:00:00 2001 From: Araq <rumpf_a@web.de> Date: Wed, 26 Mar 2014 08:42:27 +0100 Subject: borrow dots for distinct types documented --- doc/manual.txt | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'doc/manual.txt') 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 --------- -- cgit 1.4.1-2-gfad0