summary refs log tree commit diff stats
path: root/lib
diff options
context:
space:
mode:
authorAraq <rumpf_a@web.de>2012-12-02 00:44:29 +0100
committerAraq <rumpf_a@web.de>2012-12-02 00:44:29 +0100
commit76885c754a8f51a0ea34f76dd0843b1949ac7fde (patch)
treedc3a951f7d7256567c4ea699fd359675143a7051 /lib
parent9c0355a13fce08b99f2bac52d7042b73f21003d7 (diff)
downloadNim-76885c754a8f51a0ea34f76dd0843b1949ac7fde.tar.gz
first version of ropes.nim with unsafeNew (broken)
Diffstat (limited to 'lib')
-rwxr-xr-xlib/system.nim10
1 files changed, 8 insertions, 2 deletions
diff --git a/lib/system.nim b/lib/system.nim
index 9ad99fb79..e199d7611 100755
--- a/lib/system.nim
+++ b/lib/system.nim
@@ -112,11 +112,17 @@ proc new*[T](a: var ref T) {.magic: "New", noSideEffect.}
   ## creates a new object of type ``T`` and returns a safe (traced)
   ## reference to it in ``a``.
 
-proc new(T: typedesc): ref T =
+proc new*(T: typedesc): ref T =
   ## creates a new object of type ``T`` and returns a safe (traced)
   ## reference to it as result value
   new(result)
-  
+
+proc unsafeNew*[T](a: var ref T, size: int) {.magic: "New", noSideEffect.}
+  ## creates a new object of type ``T`` and returns a safe (traced)
+  ## reference to it in ``a``. This is **unsafe** as it allocates an object
+  ## of the passed ``size``. This should only be used for optimization
+  ## purposes when you know what you're doing!
+
 proc internalNew*[T](a: var ref T) {.magic: "New", noSideEffect.}
   ## leaked implementation detail. Do not use.