Re: C#/Java like interfaces for Nim

2017-03-11 Thread cdunn2001
[https://github.com/zielmicha/collections.nim](https://github.com/zielmicha/collections.nim) Joy! Great link. @Krux02, thanks for your ideas too. Very interesting discussion, but too long for tonight. Do you have a GitHub repo I can "star"?

Re: C#/Java like interfaces for Nim

2017-03-11 Thread cdunn2001
The comment from @Jehan deserves to be explained better in the Manual. This took a long time to debug. The problem is that `cast[]` is not simply "unsafe"; it's downright deceitful. I had an if-statement which was never evaluating to `true`. I couldn't believe it, so I printed the elements of

Re: C#/Java like interfaces for Nim

2017-01-23 Thread Krux02
Maybe you want to take a look at my Go like interfaces. [http://forum.nim-lang.org/t/2422#14994](http://forum.nim-lang.org/t/2422#14994) The difference between Go like interfaces and Java like interfaces, is that object that implement that interface does not need to be a ref object or inherit

Re: C#/Java like interfaces for Nim

2017-01-21 Thread Jehan
Please note that `cast[...]` is an [unsafe operation](http://nim-lang.org/docs/manual.html#statements-and-expressions-type-casts) that literally reinterprets a bitpattern and does not care at all whether the underlying representations are in any way compatible. It is something that you want to

Re: C#/Java like interfaces for Nim

2017-01-21 Thread Araq
Also worth looking at: [https://github.com/zielmicha/collections.nim/blob/master/collections/iface.nim](https://github.com/zielmicha/collections.nim/blob/master/collections/iface.nim)

C#/Java like interfaces for Nim

2017-01-21 Thread def_pri_pub
One of my favorite things from C#/Java are interfaces and I've been trying to work on writing some macros can generate an interface and allow you to implement it. So far I've played around with getting some sort of "toy interface," working as well as some of the macros too. Here is my initial