Sharding Phobos an alternative to sharding druntime

Richard Andrew Cattermole (Rikki) richard at cattermole.co.nz
Fri Jun 21 16:39:43 UTC 2024


We've had a meeting to discuss splitting up druntime a bit, 
although we got slightly off track during it.

As part of it, it was suggested by Steven that instead of 
sharding druntime, we should shard phobos, so here is my proposal.

I proposed this many many months ago, right back at the start of 
PhobosV3 work that we "shard" Phobos, of course back then I 
didn't call it as such.

The reason we did not adopt this earlier is because of some 
insistence from Walter for PhobosV3 must be import only, which I 
unsurprisingly have been against this entire time; although he 
has now accepted that this will not necessarily be possible.

The idea is simple:

- You have a root package, this has been decided to be ``phobos``.
- A sub package below that ``phobos.XYZ`` would be a "shard".
- A shard may be mapped to a binary, or it could be import only.
- Each shard would be considered independent of the others, 
however it may declare a dependency on another.
- No module can exist outside of a shard.

As a proposal it is simple to map a module to its binary.

It scales as PhobosV3 grows, with each independent shard allowed 
to do its own thing that it requires with clear dependencies.

We do not need to worry about things like event loops design work 
right now, but it does allow us to go: its a dependency of 
sockets therefore we can't do it right now.
This too was a concern of Walter's that Adam Wilson was taking on 
too much.


More information about the Digitalmars-d mailing list