Re: Convert tuple into a Object

2017-09-02 Thread zuko95
Wow Thanks. I guess I was stupid. Couldn't find it on the tutorial though

Re: Should/can we get explicit concepts?

2017-09-02 Thread zuko95
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

Re: Convert tuple into a Object

2017-09-01 Thread zuko95
@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

Re: Convert tuple into a Object

2017-09-01 Thread zuko95
@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

Convert tuple into a Object

2017-09-01 Thread zuko95
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 ???