Wow Thanks. I guess I was stupid. Couldn't find it on the tutorial though
Concepts in C++ was designed to be used without explicitly stating the
interface. I thing golang interfaces work the same way. It's a feature not a
bug
@LeuGim Yeah if it has the same fields there is no problem. But we can't be
sure that is always the case.
@jacmoe Thanks. I got tired of creating reference using the PIMPL or the
following pattern
var s:ref Person
new(s)
s.age ...
so I finally got
var
@LeGuim I guess bits would be truncated if you do the unsafe cast.
I created the following macros. It's a bit too verbose though - considering the
python/c++.
macro settattr(attr:static[string]): typed =
newNimNode(nnkAsgn).add(
newNimNode(nnkDotExpr).ad
I started learning Nim recently. Is there a way to convert a tuple into a
object? What I want is to do the following.
proc createRef(typeinfo:typedesc, data:tuple):auto =
result = new(typeinfo)
#fill the result object with the values in the tuple ???