mirror of
https://github.com/sls1005/autoderef
synced 2026-01-15 04:51:41 +00:00
No description
| src | ||
| tests | ||
| autoderef.nimble | ||
| LICENSE | ||
| README.md | ||
Auto-deref
This implements a syntax sugar for the Nim programming language. With this module imported, ptr and ref variables will be dereferenced automatically. What it does is very similar to the effect of {.experimental: "implicitDeref".}.
Example
import autoderef
type Foo = object
a: int
proc get(self: var Foo): int =
inc(self.a)
return self.a
var f: ref Foo = new Foo
echo f.get() #instead of (f[]).get()
Note
- Please ensure that the variable to be auto-dereferenced does not point to
nil.