Maybe D is right about GC after all !

Laeeth Isharc laeethnospam at nospam.laeeth.com
Sun Dec 24 16:58:16 UTC 2017


Programming languages are tools for solving problems, and people 
face different problems and they also have different capabilities 
and tastes, which means even for people facing identical 
problems, the right tool for the job may not be the same because 
they aren't identical as groups and as individuals.

Languages are also about much more than syntax; they are also 
about communities, ecosystems, and values.  In the beginning 
people generally join a community because they admire the values 
and capabilities of those prominent in the community.  Prestige 
often has a lot to do with that.

How does prestige develop?  From tangible consequences produced 
by able and virtuous people acting together to create something.  
There's a long lead time on that one, but it's not something that 
can be rushed.

It's also hard to begin something - much energy poured in for no 
tangible result.  You love your creation, but for a long time 
indeed it does not love you back.  However once it ignites then 
things take on a momentum of their own.  It's almost impossible 
to believe because you're expecting it to be difficult, like 
usual, and somehow things just almost magically start to unfold 
in that direction without your having to do that much.

On Sunday, 24 December 2017 at 15:00:09 UTC, Dylan Graham wrote:
> How much further does D have to go to start snatching C++'s 
> userbase?

That's already happening, surely.  Here there are lots of former 
C++ programmers, or professional C++ programmers who write D on 
the side.  Andy Smith gave a talk about use of D in the automated 
trading systems at a financial company - I won't say who it is, 
but it's a very well-known firm that's well established and in 
the top handful of hedge funds.

We're a newer fund (established in 2014, we were the largest 
Asian hedge fund startup), but we're starting to explore the use 
of D, and one project where we are moving to D was originally 
written in C++.  It forms the basis of our analytics across the 
firm.  And I didn't need to sell it because when someone is 
suffering they are looking for salvation, which is what D 
represents.

Before, we had C++ analytics (and for each one the implementation 
and a header file).  Then a C++ to C# shim.  Then a C# to C++ 
low-level shim.  Then a high level C# wrapper.  Then an Excel 
function wrapper written in C#.  Now you want me to add a new 
function???  And a new trader starts who would like to access the 
analytics from Python.  Oh, and it would also be nice to have the 
analytics accessible from R, Java, Julia and Matlab.

Conceptually, there are other ways to get to the same result.  
But practically for us we decided to rewrite the analytics in D 
and generate code at compile-time to wrap the functions to make 
them accessible from other languages (for native code ABI, with 
other language wrapping being generated at a combination of 
compile and run-time).  It's by far a cleaner and easier-to-read 
solution.  And it doesn't need selling to anyone, because it's an 
upfront cost that pays dividends for years not just on current 
code but all the new code that will be written in time.  D has 
unit-testing and documentation generation built in, and as far as 
the community goes, there's an expectation that you use these!

Wrapping for Excel is largely done (excel-d) and I've got 
something basic that can be used for Java if you are relaxed 
about efficiency (which we mostly are for that use case).  We're 
working on C#.  For Python we could easily use PyD (which we have 
now fixed to work also on 64 bit Windows), but we will try going 
via generating Cython as it's a bit cleaner.  There's still more 
work to do, but it's a much better solution.

And I think that's how D will be adopted.  People who have 
problems, for which using D is in part the solution.  And 
decision-makers who are acting as principals not agents, so that 
they can act without having to spend a huge investment on 
addressing social factors (there are always social factors, but 
it's a matter of proportion).

Liran at Weka didn't have to ask someone to decide to use a new 
language he had never used before for a startup building complex 
code that had to just work.  He had earned the right to decide, 
and there's plenty of risk in a startup anyway, and I suppose his 
investors trusted his judgment.  Similarly, Remedy Games had a 
problem, and from his account of it, Manu was not entirely 
serious when he suggested why don't we use D for scripting, but 
the group was receptive, and they didn't need to make a 
presentation to the board to act.  Andy Smith was in a position 
where he could 'build a prototype' in D, and then decide it 
wasn't necessary after all to rewrite in C++.

Of course recognition that D can be helpful won't happen all by 
itself.  It's worth doing the work to spread awareness, as we 
are.  But if people agree, then I think talking about success 
stories, warts and all, is likely to be quite persuasive.  And 
also to explain how to address the difficulties of relatively 
early adoption (Manu talked about documentation, training 
materials and so on).

> The C++ juggernaut keeps piling on new features every 3 years. 
> It's hard for D to stay in the lead (that is if it is).

Then why do C++ programmers here say D has ruined them for C++.  
Piling on features and never refactoring,redesigning, or removing 
old functionality - what does that lead to in an application?  
And it's not better in a programming language.

> I've been writing a voxel engine in C#. Writing anything high 
> performance in C# becomes non-idiomatic, you're locked into OOP 
> and performance sucks.
> Furthermore, C# and Java deeply emphasise the OOP paradigm. 
> They're not very expressive languages. D can do everything C#'s 
> OOP can do and offers many other paradigms. D is more a toolbox 
> to let you program the way you want. C++ is much the same, just 
> uglier. Thus, there's going to be less draw to D from C++.

And OO has other difficulties in terms of readability and 
fragmentation of the code.  The banana/gorilla/jungle problem 
described by Joe Armstrong.

> D offers far more features C# and Java. As a result, I think D 
> would have a greater appeal on those audiences.

It's not a quantity of features thing though, is it?  People 
don't like Apple products because they have more features (even 
when they do).  It's because of good design, and that's something 
you can copy but that it is difficult to do in a dynamic sense.

> I think D should try to advertise to more restrictive languages 
> such as C# and Java and present itself as a general purpose 
> language. I think it will draw more people from the C#/Java 
> crowd than it will from the C++ crowd.

Facebook say 'code wins arguments'.  So it's much better to write 
a blog post and say other people should do more along these lines 
than just argue for it.  And concrete and vivid examples might be 
more persuasive (though complementary to technical arguments).



More information about the Digitalmars-d mailing list