On Thursday, 18 February 2016 at 02:47:37 UTC, Elie Morisse wrote:
Hi all,

I now have a working D replacement for moc:

https://github.com/Syniurge/Calypso/blob/master/tests/calypso/qt5/moc

For those unfamiliar with Qt, moc (the Meta-Object Compiler) is a tool that generates additional code for Qt classes, code then used by the signal/slot system, properties and other Qt-specific extensions. While C++ moc is not going away for probably a very long time (http://woboq.com/blog/reflection-in-cpp-and-qt-moc.html), D's compile-time reflection makes it possible to replicate moc's functionality entirely with templates and CTFE, with the help of some Calypso features: C++ template instantiation, overriding C++ virtual methods, and member function pointers.

Calypso had been partially supporting Qt5 for a while and there was a Qt5 demo written by Kelly Wilson, but to work around the lack of moc he had to write an intermediate C++ class with virtual slots and the signal <-> slot connections were done in C++ code.

Now everything is in D:

https://github.com/Syniurge/Calypso/blob/master/tests/calypso/qt5/qt5demo.d

The moc package is as faithful as possible to Qt 5.5.0's moc. It's not finished yet (missing: properties, class info) but signals, slots and connections are working, making Qt 5 development in D much more practical than before.

Congratulations! This is an extremely promising result!

BTW, what do you think about DMD's recent advancement in this area? Can you reuse some of this work for Calypso? When do you think you'll be ready to start upstreaming some of your work to LDC and/or DMD?

https://github.com/D-Programming-Language/dmd/pull/5261 - Parameter types should have namespace std mangling too

https://github.com/D-Programming-Language/dmd/pull/5262 - Add versioned-out branch to support new C++-11 implementations of std::string

https://github.com/D-Programming-Language/druntime/pull/1470 - Add catching C++ exception support to dwarfeh.d

https://github.com/D-Programming-Language/druntime/pull/1473 - add core.stdcpp.exception and core.stdcpp.typeinfo

https://github.com/D-Programming-Language/dmd/pull/5330 - fix Issue 15389 - extern(C++) forward referencing problem

https://github.com/D-Programming-Language/dmd/pull/5333 - fix Issue 15519 - Circular imports leads to fwd ref error with aliased imports

https://github.com/D-Programming-Language/dmd/pull/5342 - C++ EH: initial front end work

https://github.com/D-Programming-Language/dmd/pull/5361 - fix Issue 15579 - extern(C++) interfaces/multiple-inheritance

https://github.com/D-Programming-Language/dmd/pull/5372 - fix Issue 15610 - extern(C++) multiple inheritance - calling with wrong 'this' ptr

https://github.com/D-Programming-Language/dmd/pull/5397 - fix Issue 15644 - Switch object layout ABI to MI style

https://github.com/D-Programming-Language/dmd/pull/5402 - fix Issue 15647 - Casting from one C++ interface in a hierarchy to another is a noop

https://github.com/D-Programming-Language/dmd/pull/5403 - fix Issue 15626 - extern(C++) calling crash

Reply via email to