> In Nim, i don't know if there is a way to tell the compiler "hey I don't need 
> this values here anymore, take it instead of copying it"

IMHO, that's all down to memory reference. I think the object which resides in 
memory doesn't directly pointed instead it's pointed by a pointer. Let's think 
it a box which has the "value" that points where the actual object resides.

So for example var `a` has the memory address at 0xff00 which when dereference 
it would return another address which the actual object resides, let's say it's 
in 0x1000. So if we want to move the memory to var `b`, we would give "value" 
of `b` saves 0x1000, while the memory of `b` is 0xfff0, so if we want to 
discard the `a`, we would give `a = nil` so if any further usage of `a` would 
yield an error. While the usage of `b` simply unpack the data which resides in 
0x1000.

CMIIW, with template and/or macro, you should be able to replicate those. 
Primitive value said easily copied because it's usually simple literal value or 
the type which already available for cpu targets.

Also, for copying and/or modifying, simply use `ptr` would solve your initial 
problem although it would spawn another problem.

_NB: please correct above example if you find the example is wrong, I just 
posted in in the spot without thinking it deeply_

Reply via email to