Re: How would You make abstract HANDLE?

2011-01-20 Thread Simon
On 20/01/2011 02:20, Mariusz Gliwiński wrote: 2011-01-19 19:23, Simon wrote: Traditionally: struct dummy; alias dummy* HANDLE; void doSomething(HANDLE h) { } Just don't provide a body for dummy to keep it abstract. So, if I understood correctly I can't transparently swap pointer with intege

Re: How would You make abstract HANDLE?

2011-01-19 Thread Mariusz Gliwiński
2011-01-19 19:23, Simon wrote: Traditionally: struct dummy; alias dummy* HANDLE; void doSomething(HANDLE h) { } Just don't provide a body for dummy to keep it abstract. So, if I understood correctly I can't transparently swap pointer with integer of the same size? Fair enough, but: #iface.

Re: How would You make abstract HANDLE?

2011-01-19 Thread Simon
On 19/01/2011 12:27, Mariusz Gliwiński wrote: How to make a HANDLE in D without casting and stuff: interface iface{ void doSomething(HANDLE h); } class A : iface { override void doSomething(HANDLE h) { assert(validPointer(h)); h.foo = bar; } } class B : iface { someVar table[]; override void doS

How would You make abstract HANDLE?

2011-01-19 Thread Mariusz Gliwiński
How to make a HANDLE in D without casting and stuff: interface iface{ void doSomething(HANDLE h); } class A : iface { override void doSomething(HANDLE h) { assert(validPointer(h)); h.foo = bar; } } class B : iface { someVar table[]; override void doSomething(HA