New plain tcp fiber socket class (with "how it works" docs), new arsd docs started, new dub subpackages in arsd. Also Turkish newsgroups added to forum.dlang.org

Posted 2020-12-28

A chat on Saturday about fibers and udp i/o led to me writing a couple new modules and taking my own advice on tutorials, I started writing some new docs.

Core D Development Statistics

In the community

Community announcements

See more at the announce forum.

What Adam is working on

arsd-official dub expansion

The arsd repo now has over 80 mostly independent modules, and fewer than half of them are available on dub. I started adding more of them as subpackages yesterday and they should be included in the next release there.

Included in the dub config will now be arsd.joystick, arsd.simpleaudio (and associated fileformats), and some new modules.

It is such a pain to keep that dub config up to date, I hate how much duplication there has to be in there. But oh well, once I catch up it isn't too bad to maintain it.

arsd documentation additions

I've been wanting to write some kind of web tutorial for like a decade now. I still think I have some unique features in there, but it is all buried under the code and even I don't necessarily know how to use it - I just copy/paste from my last project again.

Moreover, I type up a lot of examples and explanations on chat, but I rarely keep those in the main docs, and that is a little silly - I might as well have it, even if I just copy/paste it out in chat to save myself from typing it up again.

And after writing that tutorial for work a couple weeks ago, it made me really want to do more of that here.

So all this led to the new pseudo-package arsd.docs.

I started by writing some faqs about my general dev process, then a user asked me how to do text alignment in simpledisplay, and I realized the use of bit flag arguments might not be obvious, so I wrote a arsd.docs.general_concepts page and cross-linked it in some of those functions. I can expand more of that as time goes on.

But the real thing I want to do is arsd.docs.web_tutorial, which is going to take a significant chunk of time to finish... but for the first time, I have actually started writing it and using adrdox means I can cross link and such too.

The nice thing about doing a separate document is it also lets me be a bit higher level. See, in an individual module, I hesitate to cross the line too far. If I write about using dom documents in a web server, does that belong in cgi.d or dom.d docs? Well, here, I can obviously cross lines. And it can give users an easier starting point too.

I'll surely also do one about http client too, but idk when.

New fibersocket.d module written

A user asked me if I had a plain tcp or udp server and I said it isn't too hard to do that with Phobos, but he was also looking for something like a vibe-lite experience, with fiber-style code. I said that's not too hard with Phobos either and started writing a little module to show how.

This led to arsd.fibersocket. You should follow that link - I wrote up a description of how fibers work in general and how it was built on Phobos. The docs for arsd.fibersocket could make a blog post on their own!

New mailserver.d module in progress

While lying in bed on Christmas thinking about my web tutorial, I was thinking how it would be cool to process inbound email with a little SMTP server. At home, I have an automatic email processor and many years ago, I did one for work with Postfix (or was it sendmail? same idea though). Those would let it deliver to a local user, then it sends a biff notification which my program would read, then parse the mbox file and process the email.

Well, that's kinda a pain to set up and there's always the worry that you did it wrong and left an open relay for spammers. So I've been considering writing a little bare-bones, absolute minimum server for taking these messages for automatic processing.

It is still kinda a pain to set up since you need to do a MX record and listen on the privileged port... and sharing that with several of your applications can be painful since I'm pretty sure it needs its own IP address too - so tempting to go back to making it an open relay! And, obviously, you can still have spam, but that's true of any public internet server.

But it still might be something to consider and with the new arsd.fibersocket module, writing the code is trivial. It took me just about an hour to write arsd.mailserver and I think it is already good enough for this kind of thing.

Once I set it up on some sample VM, I'll write a bit more.