Recommendation on plotting library

Jonathan M Davis newsgroup.d at jmdavisprog.com
Fri Jul 21 06:15:10 UTC 2023


On Thursday, July 20, 2023 10:57:22 PM MDT Chris Piker via Digitalmars-d-learn 
wrote:
> (Warning, possible ill-informed opinions ahead...)
>
> In a way there is a need to reinvent the wheel.  With python I
> can run `pip install matplotlib` and get whatever binaries I need
> to get the job done.  D runs on dub, which I only see handling
> source code, and as far as I can tell, only D source code at
> that.  So unless it's D code, it can't be packaged and delivered
> easily within the D ecosystem.
>
> If dub supports either pre-built binaries, or C code (such as
> libcairo2), I'd be interested in seeing how that's done.  With
> the wizardry I've see around here, it's probably easy, I just
> don't know about it.

Well, dub is certainly designed around building projects that are pure D
without anything fancy going on, but with effort, it's possible to do far
more complicated stuff (though it's certainly far more of a pain than would
be desirable). That being said, if the C libraries are already on your
system, it's trivial to have a dub project just use them via bindings in the
D code. And there are libraries on code.dlang.org which are basically just
bindings for C libraries.

Regardless though, dub really isn't designed with packaging anything in
mind. Rather, it's designed to build your code as well as pull in D
libraries that it usees and build those too. Anyone looking to actually
package stuff would create a package from what was built with dub (e.g. with
deb, rpm, flatpacks, etc.).

> Going waaaay out on a limb for a minute, I think D shines as a
> scripting language replacement.  Most of my programs are single
> file projects these days with dub set as the interpreter.  Also
> Rust seems to be crowding the system level space and so focusing
> on it's "compiled scripts" capability avoids that competition.
>
> (If any of the statements above are faulty, I invite correction.)

D does work quite well as a scripting language replacement for a lot stuff.
In fact, the compiler and standard library have largely replaced their
Makefiles with D scripts. It's definitely worse if you want to write a
script that needs to pull in dependencies that aren't part of the standard
library, but if Phobos has what you need, it works quite well - and of
course, you can always run other shell commands from within a D program.

- Jonathan M Davis





More information about the Digitalmars-d-learn mailing list