I was able to write some D last week!

Adam D. Ruppe destructionator at gmail.com
Thu Jul 11 13:51:03 UTC 2019


On Thursday, 11 July 2019 at 13:36:17 UTC, bauss wrote:
> Most of the modules in arsd can be used separately right?

Yes, my policy is that the modules use no more than two other 
modules total.

The ones below with a star* indicate default reliance upon a 
common C library too, like openssl. I try to avoid these too, but 
I'm not as strict about it.

foundation modules (0 imports):

cgi.d (though some individual functions, if used, will import 
more), http2.d*, color.d, database.d, dom.d, jsvar.d, joystick.d, 
simpleaudio.d, argon2.d*, characterencodings.d and more.

next level (relies only on a foundation module):

simpledisplay.d, png.d, sqlite.d*, postgres.d*, mysql.d*, 
mssql.d*, bmp.d (etc), script.d. And more.

I also put minigui.d in this category, though it technically has 
two dependencies - simpledisplay.d, and through it, color.d, but 
still. nanovega.d is also on the same level as minigui, though if 
you use the image loader, it will pull in much more.

next level (combines two modules in some way):

database_generation.d, webtemplate.d, gamehelpers.d, web.d (which 
is my old web framework).



So yeah, you can see the majority of them have zero imports, then 
most the rest have only one. Only a few do more than that by 
default.

I say "by default" because in some cases, if you use other 
functions, it will import more. For example, dom.d's 
`Document.fromUrl` will implicitly import http2.d, or 
`parseGarbage` requires arsd.characterencodings, but if you don't 
use those functions, it will work by itself too.


This is basically my solution to dependency management: just have 
nothing to manage! (similarly, my approach to version management 
is to just very rarely break compatibility. My desktop tends to 
run ~6 month old dmd and my laptop tends to run ~1 year old dmd 
too, so I have broad compatibility with dmd versions as well.)


More information about the Digitalmars-d-announce mailing list