Qt bindings for D

w0rp devw0rp at gmail.com
Tue Oct 15 08:55:26 PDT 2013


On Tuesday, 15 October 2013 at 09:38:15 UTC, Max Samukha wrote:
> Long story short, D allows for two approaches to bindings like 
> QtD:
>
> 1. The traditional one is to allocate "shells" on GC heap and 
> have a set of manually specified rules for ownership transfers 
> and reference count adjustments.
> 2. The other is more interesting - abandon the idea of 
> reference/ownership annotations and go with semi-automatic 
> memory management as it is in Qt, with no reliance on the GC.
>
> At some point I wanted to switch to 2 completely, so QtD is 
> somewhere between 1 and 2, quite a mess.

This is a really interersting point, and the part of desiging the 
API I found the most difficult. How do you write an interface for 
Qt in D that is both polymorphic and avoids memory management 
problems? For instance, in PyQt and PySide, you can have objects 
vanish because you didn't keep a reference to them, even though 
some other part of Qt itself might own a reference to the object.

I couldn't think of a way to do it myself which was elegant.


More information about the Digitalmars-d mailing list