> Are you familiar with GTK and cairo?
No I'm not. I am quite familiar with C/C++ FFI, ref and ptr though in high
performance context where allocation is very expensive (GPUs memory allocation)
and the GC is a bottleneck.
In short, for a local variable, I have the following strategies:
* If trivial type: use `let`
* If I want an alias but type is not trivial:
* Use a template for aliasing
* take the address and pass that around
For the types:
* Trivial type to copy: stack object
* Non-trivial (i.e. resource with notion of ownership of the
file/database/memory/socket/window):
* `ref` if pure Nim
* `ptr``(potentially stored in a ``ref`) for FFI
In your case, if you use ptr or template for aliasing instead of let/var you
will not have a =destroy call at the end of the function.