www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - Adding D code to a C++ codebase

reply Russel Winder via Digitalmars-d <digitalmars-d puremagic.com> writes:
Say I have a C++14 codebase, for arguments sake let's call it Me TV.
Say I fancy rewriting it in D, but incrementally not as a "big bang".
Actually I may start by adding new features in D code rather than C++.
In any event it is a mixed C++/D code with a C++ main.

The build is currently CMake (because of CLion) and Meson (because it's
a Gtk+3 application).

Can anyone point me at anyone successfully doing mixed C++/D codebases
with those build systems?

That I will try this conversion is not yet certain. Why? Tooling. C++
is very well supported by tools and IDEs, D is not.

CLion, IntelliJ IDEA, Eclipse/CDT, Xcode, and Visual Studio seem to be
the IDEs of the moment. There is effort to get D support in IntelliJ
IDEA, but CLion is where the C++ folk are. Eclipse/CDT appears to have
lost all activity on the D support. I'm on Linux so Visual Studio is
not an possibility.

(Emacs, Vim, etc. really do not cut it for me any more, Since using
PyCharm, IntelliJ IDEA and CLion for Python, Kotlin, Groovy, Java, C++
=E2=80=93 it is left as an exercise for the reader to match language to IDE=
 =E2=80=93 I
cannot imagine not using a good IDE for programming.)=20

I guess I am leading up to: I wonder how many people look at D and walk
away because the tooling is not up to that of C++ and Python?

--=20
Russel.
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D
Dr Russel Winder      t: +44 20 7585 2200   voip: sip:russel.winder ekiga.n=
et
41 Buckmaster Road    m: +44 7770 465 077   xmpp: russel winder.org.uk
London SW11 1EN, UK   w: www.russel.org.uk  skype: russel_winder
May 06
next sibling parent reply qznc <qznc web.de> writes:
On Saturday, 6 May 2017 at 11:44:28 UTC, Russel Winder wrote:
 CLion, IntelliJ IDEA, Eclipse/CDT, Xcode, and Visual Studio 
 seem to be the IDEs of the moment. There is effort to get D 
 support in IntelliJ IDEA, but CLion is where the C++ folk are. 
 Eclipse/CDT appears to have lost all activity on the D support. 
 I'm on Linux so Visual Studio is not an possibility.
There is a plugin for IntelliJ [0], but I have not tried it. I don't know the Jetbrains products. Is Clion and IntelliJ IDEA the same core with different plugins and branding or is it really different? [0] https://github.com/intellij-dlanguage/intellij-dlanguage
May 06
parent Russel Winder via Digitalmars-d <digitalmars-d puremagic.com> writes:
On Sat, 2017-05-06 at 12:11 +0000, qznc via Digitalmars-d wrote:
 [=E2=80=A6]
=20
 There is a plugin for IntelliJ [0], but I have not tried it. I=C2=A0
 don't know the Jetbrains products. Is Clion and IntelliJ IDEA the=C2=A0
 same core with different plugins and branding or is it really=C2=A0
 different?
=20
 [0] https://github.com/intellij-dlanguage/intellij-dlanguage
=20
There is indeed this work, and I am supposed to be helping out on it. :-) However, it really needs more support to become mainstream: more people actively working on it is the only way to get somewhere good in a reasonable timescale. C++ is supported in IntelliJ IDEA and has a whole IDE CLion. Go has a plugin, but also a whole IDE Gogland.=20 Rust is rapidly creating an excellent plugin for IntelliJ.=20 The trick to all these is paid labour or lots of serious volunteer effort. Whether we like it or not, these days, the viability of a programming language is determined as much by the IDE support as the language itself. DDT has gone dormant, which is sad as a lot of C++ people use Eclipse. Netbeans also has good C++ support, but is a bit niche. We at least have an entry in the JetBrains IDE game, I think we have to push this to get great support for D in CLion and IntelliJ IDEA not just so we can develop stuff, but because D will be judged in the C++ vs Rust vs Go vs D race by it's commonly used IDE support. Or at the moment lack of it. --=20 Russel. =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D Dr Russel Winder t: +44 20 7585 2200 voip: sip:russel.winder ekiga.n= et 41 Buckmaster Road m: +44 7770 465 077 xmpp: russel winder.org.uk London SW11 1EN, UK w: www.russel.org.uk skype: russel_winder
May 06
prev sibling parent reply Joakim <dlang joakim.fea.st> writes:
On Saturday, 6 May 2017 at 11:44:28 UTC, Russel Winder wrote:
 Say I have a C++14 codebase, for arguments sake let's call it 
 Me TV. Say I fancy rewriting it in D, but incrementally not as 
 a "big bang". Actually I may start by adding new features in D 
 code rather than C++. In any event it is a mixed C++/D code 
 with a C++ main.

 The build is currently CMake (because of CLion) and Meson 
 (because it's
 a Gtk+3 application).

 Can anyone point me at anyone successfully doing mixed C++/D 
 codebases with those build systems?
ldc is a mixed D/C++ codebase using CMake: https://github.com/ldc-developers/ldc/blob/master/CMakeLists.txt
 That I will try this conversion is not yet certain. Why? 
 Tooling. C++ is very well supported by tools and IDEs, D is not.

 CLion, IntelliJ IDEA, Eclipse/CDT, Xcode, and Visual Studio 
 seem to be the IDEs of the moment. There is effort to get D 
 support in IntelliJ IDEA, but CLion is where the C++ folk are. 
 Eclipse/CDT appears to have lost all activity on the D support. 
 I'm on Linux so Visual Studio is not an possibility.
VS Code?
 (Emacs, Vim, etc. really do not cut it for me any more, Since 
 using
 PyCharm, IntelliJ IDEA and CLion for Python, Kotlin, Groovy, 
 Java, C++
 – it is left as an exercise for the reader to match language to 
 IDE – I
 cannot imagine not using a good IDE for programming.)

 I guess I am leading up to: I wonder how many people look at D 
 and walk away because the tooling is not up to that of C++ and 
 Python?
I use Vim, I wouldn't know.
May 06
parent Russel Winder via Digitalmars-d <digitalmars-d puremagic.com> writes:
On Sat, 2017-05-06 at 13:42 +0000, Joakim via Digitalmars-d wrote:
=20
[=E2=80=A6]
 ldc is a mixed D/C++ codebase using CMake:
=20
 https://github.com/ldc-developers/ldc/blob/master/CMakeLists.txt
=20
Of course it is. I should have known that. I shall delve into its build. --=20 Russel. =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D Dr Russel Winder t: +44 20 7585 2200 voip: sip:russel.winder ekiga.n= et 41 Buckmaster Road m: +44 7770 465 077 xmpp: russel winder.org.uk London SW11 1EN, UK w: www.russel.org.uk skype: russel_winder
May 06