Code organization, dub, etc.

Bradley Chatha sealabjaster at gmail.com
Mon Mar 13 12:56:57 UTC 2023


On Monday, 13 March 2023 at 10:52:11 UTC, Joe wrote:
> months.  Am I missing something on how to deal with 
> multi-executable projects in dub (and I can think of many such 
> projects)?

Dub isn't very good at doing more than relatively basic things 
natively (which covers enough D projects for it to not matter in 
the general case). I personally like to use Meson with D. e.g. It 
[very easily 
allows](https://github.com/BradleyChatha/libbc/blob/master/meson.build#L84) multiple executables.

Technically you can use the build command values in dub.json/sdl 
to make it spit out an extra build; but it's obviously a bit of a 
hack. You could also have a small script/makefile to call the 
right `dub build` twice.

The issue with using Meson is that it makes using dub packages 
harder. Meson technically supports bringing in dub packages, but 
I've not managed to make it work right.

For better or for worse we're stuck with dub as the standard 
package manager + build tool one-in-all for most of our open 
source libraries.

> I also tried to use `dfmt` and found it limited in comparison 
> to `clang-format`. I do realize that dfmt is a 
> community-supported tool.

D's auxiliary tooling has been woeful in comparison to other 
languages for the last 8 years I've been using it. It's down to a 
few factors such as manpower; lack of use/inability to use the D 
compiler's frontend for tooling, etc.

On the other hand the reason it feels bad to me is also because I 
mostly use C#; Typescript, and Go outside of using D - all of 
which have great (bar NPM) tooling and editor support so D may 
not actually be that bad overall. Glass Half Full or Half Empty 
kinda perspective.

It's constantly getting better, but is always "behind" the more 
popular languages. If you were to write up your struggles with 
dfmt and friends, then I'm sure it'll be taken as welcome 
feedback.

> I find that D has much to offer in terms of language facilities 
> and simplicity. About the only bump in the learning curve is 
> the distinction between structs and classes.

Have you met our lord and savior: D's metaprogramming? :D 
([Shamless plug](https://www.youtube.com/watch?v=0lo-FOeWecA))

But yeah generally you might find D is a bit less "cohesive" and 
may feel kind of "splattered" in terms of... well, everything 
about it. It's a volunteer project with a dire lack of volunteers.

Hope this helps, and hopefully I've kept misinformation to a 
minimum as I am very prone to working off of false memory.


More information about the Digitalmars-d-learn mailing list