Ideal D GUI Toolkit

Daniel Murphy yebblies at nospamgmail.com
Tue May 21 04:00:21 PDT 2013


"Jonathan M Davis" <jmdavisProg at gmx.com> wrote in message 
news:mailman.1428.1369071743.4724.digitalmars-d at puremagic.com...
> On Tuesday, May 21, 2013 03:33:01 Daniel Murphy wrote:
>> I don't know much about Qt's source, but automatic conversion to D, like 
>> we
>> are doing for the compiler, might be worth looking into. If it is written
>> in modern-ish C++ (not too many preprocessor hacks), which from a quick 
>> look
>> it appears to be, this might be a much more reasonable task than writing 
>> a
>> new gui lib from scratch.
>
> IIRC, they use macros quite a bit for various stuff (like signals and 
> slots),
> and they have their own version of make to set up some stuff for you. So, 
> my
> first guess is that conversion would be a bit of a beast. But it's been a 
> while
> since I did much with Qt.
>
> - Jonathan M Davis

If the macro can be easily converted to a mixin or function call, it usually 
isn't too bad.  It's when the code is not even close to valid c++ (COM class 
definitions spring to mind) that things get tricky.

eg
#define INC(x) do { (x)++; } while(0)
is fine as it can be translated to a function call, but
#define BEGIN {
is a huge problem, because it won't parse.

Even if the macros are hairy, so long as there are a relatively small 
number, they can be special cased.

Qt's special preprocessor is a whole other story, but hopefully that can be 
emulated somewhat in D code.  Requiring a template mixin per Qt class is not 
too big a deal. 




More information about the Digitalmars-d mailing list