Calypso: Direct and full interfacing to C++
Elie Morisse via Digitalmars-d-announce
digitalmars-d-announce at puremagic.com
Thu Jan 22 16:16:04 PST 2015
On Thursday, 22 January 2015 at 00:08:13 UTC, Walter Bright wrote:
> Just making STL work would be an achievement!
>
> Is the output of Calypso a file that can be imported?
The only outputs specific to Calypso are ligthweight object files
per C++ module that contain symbols created by LDC for aggregates
(InitZ...) and template specializations by Clang if they're not
defined in the PCH.
What Calypso basically does is tell Clang to generate a big PCH
for all the headers in modmap directives, and to map "on demand"
C++ declarations from the PCH to D symbols in a separate tree of
modules (hence the (C++) in imports, they're not physical
modules). Those symbols can be used like D's, although they have
different implementations to handle the C++ specificities, and
all the non-trivial semantic work is done by Clang libraries and
queried back by Calypso (aggregate layout, partial template
argument deduction, ...).
There are still some very "feels hackish" areas like the fact
that DMD considers C++ classes to derive from Object too
(fortunately Object is only a handful of virtual functions), I
haven't solved yet how class values should be treated, etc.
Also the PCH is a temporary solution because at the time I began
working on Calypso Clang's support for modules was broken. But
they would be great to break the global namespace in smaller
pieces, so now that they seem ready to use the plan is to replace
the PCH by them, or by a slightly different flavor of them
(because there's currently one limitation that reduces its
usefulness, it's that one header can't be split across several
modules).
More information about the Digitalmars-d-announce
mailing list