added 'reset' magic proc

This commit is contained in:
Araq
2011-03-25 01:49:42 +01:00
parent 032599c156
commit bd4f0b94ae
9 changed files with 73 additions and 12 deletions

View File

@@ -88,8 +88,7 @@ proc new*[T](a: var ref T, finalizer: proc (x: ref T)) {.
## the object! This means that for each object of type `T` the finalizer
## will be called!
proc reset*(obj: var T) {.magic: "Reset", noSideEffect.}
proc reset*(obj: ref T) {.noSideEffect.} = reset(obj^)
proc reset*[T](obj: var T) {.magic: "Reset", noSideEffect.}
## resets an object `obj` to its initial (binary zero) value. This needs to
## be called before any possible `object branch transition`:idx:.