On Thursday, 9 June 2016 at 16:44:23 UTC, Yura wrote:
Hello,
I have to stress I am beginner in programming, mainly
interested in number crunching in academia (at least so far). I
started to write a small project in D, but had to switch to C
for few reasons:
1) Importance for my CV. I know Python, if I add also C - it
sounds, and could be useful since the C language is, apart from
the other reasons, is popular and could help me wit the future
job, both in academia and industry, since there are many C/C++
projects.
I wouldn't worry too much about the CV. Maybe in a year or two
companies will demand you know Ruby or Javascript :) Once you
know who to program it's not so hard to pick up other languages.
The basic concepts of handling / mapping data are always the same
(hash tables, arrays ...)
2) The libraries - in the scientific world you can find
practically everything which has already been coded in C, =>
many C libraries. To link it to be used within D code requires
some work/efforts, and since I am not that confident in my IT
skills, I decided that C code calling C libraries is much safer.
It's a piece of cake most of the time, it's really easy.[1] When
I first tried it, I couldn't believe that it was _that_ simple. I
use some C code too in one of my projects and it's easy to either
call individual C functions or, if needs be, you can turn a C
header file into a D interface file with only a few changes (they
will almost look identical).
There is absolutely no reason not to use D because of existing C
libraries. The seamless interfacing to C is one of D's major
advantages. In this way you can write elegant D code and still
take advantage of the plethora of C libraries that are available.
Here are examples of porting C libraries that have D interfaces:
https://github.com/D-Programming-Deimos?page=1
If you need help, you can always ask on the forum. Nobody will
bite you :-)
There are even D frameworks that enable you to interact with
Python [2] and Lua. I'd say give it a shot.
[1] http://dlang.org/spec/interfaceToC.html
[2] https://github.com/ariovistus/pyd
Other links:
http://dlang.org/ctod.html
http://dlang.org/articles.html
3) For C - a lot of tutorials, everything has been explained at
stack overflow many times, huge community of people. E.g. you
want to use OpenMP, Open MPI - everything is there, explained
many times, etc.
4) The C language is well tested and rock solid stable.
However, if you encounter a potential bug in D, I am not sure
how long would it take to fix.
5) Garbage collector - it will slow my number crunching down.
You should test it first, gut feeling is not a proof. If it
really does slow down your code, write GC free code, as ketmar
suggested. You can always ask on the .learn forum.
Please, do not take it as criticism, I like D language, I tried
it before C and I find it much much easier, and user friendly.
I feel it is more similar to Python. On the other hand C++ is
too complex for me, and D would be the perfect option for the
scientific community, if the above points would be fixed
somehow..
Best luck with your work!