D vs Rust

Eljay via Digitalmars-d digitalmars-d at puremagic.com
Sun Sep 3 11:26:59 PDT 2017

I work on a large multi-platform desktop shrink-wrap application. 
  It is a large application, with a code base of over 400,000 
files.  The majority of which is C++, although there is some 
JavaScript in the mix in some of the corners of the UI.  The code 
base is about 30 years old... so you probably can imagine that 
the code has room for improvement.

For an existing project of that size, it makes no sense to try to 
throw it out and start over.  That would be recklessly 

I was fantasizing:  if the app were to be written today, what 
would be suitable languages?

C++17, is a shoe in, since that corresponds to reality (if looked 
at through a carnival mirror, since the actual code is smeared 
across C++89 - C++98/03 - C++11/14 - C++17 like cities built on 
top the ruins of cities, and its turtles all the way down).

Since I'm a D fanboy, I put D on the list.  And I think these as 
well:  C#, F#, Go*, C, Lua (with some core functionality in C), 
Java, Groovy*, Scala*, Swift.  And maybe, at a stretch, Ada*, 
Clojure*, Kotlin*.

* I've no practical experience in these languages.

A friend of mine said I should add Rust* to the list.  I'm not 
familiar with Rust, so today is my "dive into Rust" day.  That's 
how I got here.  (Hi Walter!  Hi Bearophile!  I've been away for 
a long while.)

In my fantasy, the biggest challenge with a large multi-platform 
application is the tooling and support.

So some of the questions that are meta-language related are...

What are the IDEs like?  People want to have bother-free version 
control, enjoyable debugging experience, works on the target 
platforms, manage very large projects.  C++ has excellent support 
by Visual Studio, and very good support by Xcode.

What do the standard libraries offer?  C++ has a reasonably nice 
standard library.

What off-the-shelf libraries can be leveraged?  C++ has Boost, 
and many others.  A vibrant ecosystem.

Can the language "do the job"?  Part of "doing the job" is 
interoperating with the target platform.  In this fantasy case, 
Win32 with GDI/GDI+ (possibly .NET as a viable alternative), and 
Cocoa.  If that involves writing a C-API bridging layer from 
Language X to Host Platform, that is friction.  A fantasy project 
this size can absorb that kind of friction.

Can we hire 100+ programmers willing to use that language?

Those things are important, even though they are outside the 
domain of the language itself.  Toolchains.  IDEs.  Tool vendor 
stability.  Debugging.  Large project management.  Version 
control.  Suitability.  Community & ecosystem.  Human resources.

Since my love-hate relationship with C++ is well known, in my 
do-over fantasy world, I hope there is a better suited language.

And "make your own language" is not on the table.  I've read 
Aho's dragon book... I've tried that... it is VERY HARD to make 
your own general purpose language, and will consume 10+ years of 
your life.  Bjarne Stroustrup said, "If you do anything useful it 
will haunt you forever after, and if you have a major success you 
get decades of hard manual labor - meaning you have to work on 
the manual."  *hugs* to Walter & Andrei.

A cautious person would probably say "Use Swift on Mac, use C# or 
F# on .NET on Windows.  Write the code twice.  Boom, done."  
That's been tried, turns out maintaining parity that way does not 
work out so well.  Case in point:  check out Office for Windows, 
and Office for Mac.

Step back...

Why am I sharing this on this forum?

I think these meta-language issues need to be thought about to 
help D gain more traction.  In addition to the core language 
issues that Andrei has already discussed in depth, and were 
mentioned again in this thread.

And I really love D.  It speaks to me.  It is the language I wish 
C++ was.  If I could have created a language, I would compare it 
against D as my gold standard.

I look at the history of RemObjects, and how they had a 
distributed object technology... but to support it they had to 
become a language vendor (of Oxygene, their version of Delphi, 
which is Apple/Wirth's Object Pascal), and then had to create 
their Elements compiler, and extend it to support multiple target 
platforms, and then extend it more to support multiple languages 
(Object Pascal, C#, Swift, Java) in their ecosystem.  And now 
they've jumped into the IDE game.  It is interesting to note that 
where they started and how they got to where they are is an 
interesting journey of necessity.

More information about the Digitalmars-d mailing list