Is D a good choice for embedding python/octave/julia

Lass Safin via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sun Mar 13 09:16:13 PDT 2016


On Sunday, 13 March 2016 at 13:02:16 UTC, Bastien wrote:
> Hi, apologies for what may be a fairly obvious question to some.
>
> ## The background:
> I have been tasked with building software to process data 
> output by scientific instruments for non-experts - basically 
> with GUI, menus, easy config files (JSON or similar) - and the 
> ability to do some serious number crunching.
>
> My background is python/octave and would be happy building it 
> in python (or god forbid, even octave), but it would end up 
> clunky and slow once ported to a standalone executable. Hence 
> why I'm looking at other languages. D caught my eye.
>
> ## The problem:
> The sticking point is unless I commit the rest of my life to 
> maintaining this software, I can't write it all in D. The 
> algorithms change/are improved yearly; the output format from 
> the instrument changes once in a while and therefore these need 
> to be easily scripted/modified by other (non-programming) 
> scientists and the community that only really know python and 
> octave.
>
> Essentially I'd like a D front end, and a D back-end that does 
> most of the memory and data management but calls and interprets 
> .py, .m and/or .jl scripts (python, matlab, julia) to know how 
> to treat the data. This leaves the py/m/jl scripts visible to 
> be edited by the end user.
>
> ## The question:
> Can it be done?
> Does this entirely defeat the point of using D and I should 
> just code it in python because of the added overheads?
>
>
> Thanks for your help!
> B

I REALLY don't think you should use _any_ scripted language, if 
what you're looking for is speed.
Now for your main question:
It can be done.
An incomplete list of libraries and bindings for D: 
http://wiki.dlang.org/List_of_Libraries_and_Frameworks.
It includes tools such as GTK.

And I'm very sure that it will be faster than writing it 
completely in python.

Another thing: I myself find D *much* easier to program in than 
python (having experience in both). The many meta-programming 
tools in D and the nice syntactic features of D really make-up 
for the increased complexity of the language compared to Python.


Somethings I'd like to recommend: OpenCL. For algorithms and 
such, using the GPU is much much faster than using the CPU.


More information about the Digitalmars-d-learn mailing list