Thread overview
Adding D code to a C++ codebase
May 06, 2017
Russel Winder
May 06, 2017
qznc
May 06, 2017
Russel Winder
May 06, 2017
Joakim
May 06, 2017
Russel Winder
May 06, 2017
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++
– 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?

-- 
Russel. ============================================================================= Dr Russel Winder      t: +44 20 7585 2200   voip: sip:russel.winder@ekiga.net 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, 2017
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, 2017
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, 2017
On Sat, 2017-05-06 at 12:11 +0000, qznc via Digitalmars-d wrote:
> […]
> 
> 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
> 

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.

Rust is rapidly creating an excellent plugin for IntelliJ.

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.

-- 
Russel. ============================================================================= Dr Russel Winder      t: +44 20 7585 2200   voip: sip:russel.winder@ekiga.net 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, 2017
On Sat, 2017-05-06 at 13:42 +0000, Joakim via Digitalmars-d wrote:
> 
[…]
> ldc is a mixed D/C++ codebase using CMake:
> 
> https://github.com/ldc-developers/ldc/blob/master/CMakeLists.txt
> 

Of course it is. I should have known that. I shall delve into its build.

-- 
Russel. ============================================================================= Dr Russel Winder      t: +44 20 7585 2200   voip: sip:russel.winder@ekiga.net 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