Re: Reference counting for resource management

2009-11-30 Thread Bartosz Milewski
Denis Koroskin Wrote: I think RefCounted should be flexible enough to re-usable for other data structures, too (e.g. so that it could be part of Phobos). I agree. However this code goes into core, so it can't use Phobos. By the way, your code has a bug: Tid tid; // or release() and

Re: Reference counting for resource management

2009-11-29 Thread Bartosz Milewski
I don't think you need opAssign. The compiler will automatically use bitblit and postblit. Here's my implementation of a reference counted thread id structure for comparison: struct Tid { this(HANDLE h) { _h = h; Counter * cnt = cast(Counter *)

Re: Reference counting for resource management

2009-11-29 Thread Denis Koroskin
On Mon, 30 Nov 2009 03:19:33 +0300, Bartosz Milewski bartosz-nos...@relisoft.com wrote: I don't think you need opAssign. The compiler will automatically use bitblit and postblit. Here's my implementation of a reference counted thread id structure for comparison: struct Tid {

Re: Reference counting for resource management

2009-11-29 Thread LMB
Don Wrote: LMB wrote: [...] So, is there any complete example on how to implement reference counting in D2? I don't think so. While trying to do it, Bartosz found some severe bugs in D which made it impossible; they were fixed in the last release. He's since found bug 3516 might

Re: Reference counting for resource management

2009-11-28 Thread Don
LMB wrote: Hello, This should be my first post here, but I just posted the same message on the standard D newsgroup by mistake (what a noob! :-P) So, here I go again, on the right forum this time... I am trying to create yet another D2 wrapper for SQLite. As usual with many C libraries,

Reference counting for resource management

2009-11-27 Thread LMB
Hello, I've been reading the forums for some time, but this is my first post here :-) I am trying to create yet another D2 wrapper for SQLite. As usual with many C libraries, SQLite provides us some objects and functions to create and destroy them. So, I decided to encapsulate these SQLite

Re: Reference counting for resource management

2009-11-27 Thread LMB
LMB Wrote: Hello, [...] Ouch! I thought I was posting to the learn group. My bad, sorry!

Re: Reference counting for resource management

2009-11-27 Thread Denis Koroskin
On Sat, 28 Nov 2009 01:27:41 +0300, LMB lmbar...@gmail.com wrote: Hello, I've been reading the forums for some time, but this is my first post here :-) I am trying to create yet another D2 wrapper for SQLite. As usual with many C libraries, SQLite provides us some objects and functions

Reference counting for resource management

2009-11-27 Thread LMB
Hello, This should be my first post here, but I just posted the same message on the standard D newsgroup by mistake (what a noob! :-P) So, here I go again, on the right forum this time... I am trying to create yet another D2 wrapper for SQLite. As usual with many C libraries, SQLite provides