Compare boost::hana to D

Laeeth Isharc via Digitalmars-d digitalmars-d at puremagic.com
Wed Apr 19 03:58:06 PDT 2017


On Wednesday, 19 April 2017 at 08:19:52 UTC, Ali Çehreli wrote:
> I'm brushing up on my C++ to prepare for my C++Now 2017 
> presentation[1]. boost::hana is an impressive library that 
> overlaps with many D features:
>
>   
> http://www.boost.org/doc/libs/1_64_0_b2/libs/hana/doc/html/index.html
>
> Have you used boost::hana? What are your thoughts on it?
>
> And please share your ideas for the presentation. There has 
> been threads here about C++ closing the gap. Does D still bring 
> competitive advantage or is it becoming irrelevant? (Obviously, 
> some think its irrelevant already.) I'm trying to collect 
> opinions... :)
>
> Thank you,
> Ali
>
> [1] 
> http://cppnow.org/2017-conference/announcements/2017/04/09/d-keynote.html

Hi Ali.

Hope you're well.

I think not enough has been written on D's plasticity - Andrei 
and Walter talk about it in passing a couple of times.  But I 
have the impression that it's maybe quite important for merits of 
D's real world commercial value. Compare using refactoring  tools 
with not really needing them to same extent.

Something related to that.  I can go back and read my D code from 
early 2014 when I was learning D and it's all perfectly clear to 
me.  My python code not so much.  And two of the people working 
with me on D side have no professional experience in finance, but 
it didn't take long for them to get up to speed on my project 
which is maybe 120k SLOC plus some wrapping code.  I didn't have 
time or bandwidth to write comments or tests yet it was quite 
feasible to understand code without them.

On the other hand I was reading some object oriented C++ code of 
20k lines split between 200 files.  I just about read C++ so 
ceteris non paribus.  But the fragmentation and artificial 
abstraction makes it much harder to see what's going on and it's 
scarier to change it.  Plus template errors in C++! And that 20k 
lines is maybe 6k lines in 10 files in D.

I haven't always been super happy about using dub on Windows and 
like Manu said there is an energy gap introducing Windows 
colleagues to D.  Bad enough from C++, let alone C#.  However dub 
isn't worse than cmake - porting some windows C++ code to build 
on linux.

The keynote by the embedded device guy at last years c++ conf was 
spot on - if you're arguing you're losing.  Why should I use D? 
Well probably you shouldn't if you don't want to.  In fact in 
these cases you definitely shouldn't, whether you want to or not. 
  However some people find its brought them some benefits and here 
are some if the commonalities.

Some concrete examples that are true and essentially real might 
be a nice counterpart to the "quicksort in two lines" language 
evangelism that Andrei rightly complains about.

Maybe you have some from Weka.  Please ask Atila Neves if some 
finance examples might be helpful.  (Eg excel-d, which I started 
and Stefan and Atila finished).

One last thing.  D is a pretty good language for getting stuff 
done quickly in for a prototype that can be cleaned up quickly. 
That's a point Andy Smith made, and that Liran made in his talk 
also.  I am having to deal with that increasingly now.  I would 
certainly much rather turn a D prototype written by a trader into 
production than a python one - lets not speak of Matlab! This 
aspect is mentioned on website but should be hammered home - it's 
a practical language for getting started stuff done fast  without 
leaving a mess.






More information about the Digitalmars-d mailing list