Uphill
weaselcat via Digitalmars-d
digitalmars-d at puremagic.com
Sun May 24 14:40:06 PDT 2015
On Sunday, 24 May 2015 at 20:36:47 UTC, Laeeth Isharc wrote:
> Weaselcat:
>
>> FWIW I'm not picking on Rust, I used it for a rather long
>> time(while in beta, obviously) before I switched to D full
>> time for my academic work and I don't regret my decision. I
>> thought Rust would get more improvements than it did. I feel
>> like they made so many poor decisions as the development went
>> on, cut so many good features etc just to cater to the non-ML
>> crowd that the language ended up being a frankenstein mess.
>>
>
> Hi.
>
> Without wishing to dwell on the negatives of alternatives,
> might I ask what made you decide to settle on D?
Before I was mainly using C++ for my work(and dabbled in Rust,
but never ended up switching to it)
D's C-like syntax inspires familiarity to the point where I truly
believe that D is easier to port C code to than C++ because you
can write D in a "cleaned up" C for the most part, and slowly
turn it into D whereas C++ is essentially a completely different
style. Not too many languages can really claim this, and IMO it's
a huge boon.
D provides native performance directly on comparison with C/C++
while being much easier to jump in and bash out a few quick
ideas(Phobos helps a lot with this.)
Phobos offers far more than the C++ standard library as well.
It's nice not to have to go hunting for libraries, C++11 helped
with this a little I guess but it just feels like "it's there,"
whereas Andrei/Walter seem to actively be working towards "you
should always be using Phobos or it should be fixed."
Also, D's metaprogramming system is actually usable. I use CTFE
to do a ton of precomputations at compiletime, I even recently
learned that the compiler can unroll foreach loops in switches(!
that's cool - D has a lot of neat tricks that nobody really seems
to discuss,) I feel like I'm always learning new tricks in D, and
not in the C++ way.
The ability to use C libraries with barely any fuss(!), I ported
a C's library's headers to D in about 10 minutes using htod and a
bit of manual touchup. This is a `killer feature` in my opinion.
Ranges/functional programming in general, C++ really has nothing
on this. I think C++17 might be getting ranges but when I
reviewed the paper they seemed far uglier and an
afterthought(like most of C++), I've written large parts of my
programs in purely functional style and LDC optimizes it to the
equivalent imperative code.
D's operator overloading is extremely well designed IMO,(it just
goes with the rest of the 'make D work the way you want it to'
feeling of the rest of the language)
I feel like I could write a book on why I use D, so I'm going to
stop now : )
> Do you have collaborators who write code and, if so, how did
> the discussions with them go about this? For your use case,
> what have been the main gains you have seen and how long did it
> take before these started to come through?
No, but my advisor was very open to the idea of me using D. He
was familiar with it, but never used it himself(this seems to be
fairly common.)
I went from prototyping in python and porting into C++ as
necessary to just doing everything in D, and I think this has
saved me a lot of time.
D(md) compiles pretty fast, I think it used to have a bigger
advantage here over C++ before Clang became popular but it's
still pretty darn fast and makes for python-esque edit-run-debug
editing style. I went from compiling my projects on the
university servers to my home desktop(and it compiles faster.)
>
> I am interested because I may have the chance to persuade some
> people to explore using D, and I would like to know honestly
> what some experiences are of people who have made that change.
> (My personal experience may not be so easy to generalize from).
>
>
> Thanks.
>
>
> Laeeth.
I think D's best quality is probably how approachable it is for
C/C++ programmers compared to i.e, Rust which has a (weird) ML
influence. I wouldn't be surprised if you could get a C or C++
programmer up to speed in D in an afternoon, at least enough to
be efficient in it.
D is of course not all roses, shared still feels half implemented
and left to rot(D's memory model in general.) TDPL is aging, and
there's not too much other literature on D - but Ali's book is
very good. The compiler situation feels odd, LDC and GDC have
very few contributors despite being better than dmd at optimizing
and providing a lot of extra perks - i.e, LDC lets you use all of
the LLVM sanitizers like the thread, memory, etc. ones, and LDC
provides in-depth optimization analysis thanks to LLVM.
But comparatively, this list is not so bad.
I'm not sure if my specific experience was what you're looking
for, but maybe this helped.
More information about the Digitalmars-d
mailing list