arsd package updates, forum nonsense

Posted 2019-10-21

arsd-official tagged 4.1.4, my 11 1/2 old library demonstrates compatibility with Slackware's gdc package as well as newest dmd.

Core D Development Statistics

In the community

Community announcements

See more at the announce forum.

On the forums

The forum this week had a monster thread with all kinds of silly stuff, leading to renewed talk about moderation and lots of mudslinging.

Personally, I think most of it was ridiculous, but there is some talk about interfaces and private I found interesting enough to talk about, and I want to mention some thoughts on moderation.

Interfaces and the private keyword

There's some people in the community who dislike D's private meaning private to the module rather than private to the discrete aggregate. I personally like it just the way it is, but I wouldn't fight against adding something like private(class) as an additional level as long as it reflects similarly to regular private so I don't have to add another case to my code :P

But anyway, I'd like to propose a couple alternatives. One is doing privacy like in older Javascript versions: local variables inside a function are your private ones, and a returned object has the private ones. I'm only half serious about that... but that's more than totally not serious, it would work.

My more serious thought though, and keep in mind it is usually OOP users who speak out against D's definition or private, is to leverage interfaces.

If you write a function that only takes an interface, defining the minimum set that makes sense instead of the whole concrete class, you don't have access to the private implementation!

Well, OK, you kinda do, through cast, but that's already iffy OO design, and will not happen by accident, so just... don't do that.

And as a benefit, your function may be more reusable by other classes too. See, that's the real reuse OOP offers: not reusing parent implementations, but reusing consumer functions written against the interface.

It really is pretty decent.

Moderation and NNTP

Another common refrain that came up again this week was that D needs a "modern forum". I disagree for several reasons, but the one I want to write about here is moderation tools are totally possible with the client-agnostic system we have now (whether web, email or newsgroups).

An email or NNTP server doesn't have to accept every message it gets. It is allowed to reject them for a variety of reasons... and using that, we could ban people by rejecting all their messages. We can lock threads by rejecting messages that are in reply to them. (Actually, since this works by referring to parent messages, we could just lock one branch of a conversation while keeping other, more productive branches going.)

Heck, it could even modify messages and insert warnings like "THIS MESSAGE IS IN REPLY TO A POST FROM 2015".

These controls could even be processed from clients, though I imagine the easiest way would be for the moderators to use a special part of the web interface. But for other users, their messages would be rejected by means standard clients already understand and thus do not need special modifications.

Compared to the requests for new post syntaxes and such (which are also possible using mime standards btw!) this is actually pretty easy to do without a major overhaul of the forum architecture.

What Adam is working on

On the Android project, it continues to go very slowly as I work through the IDE and build systems. Probably a couple more weeks until I get around to it all.

In the D open source world, I did some work on dpp to get it to work better on Windows.

And in my repo, I did some work to get better compatibility:

  • I updated the Makefile to cross compile on different compilers and platforms, all with warnings enabled.
  • Updated the dub.json to work better for more users.
  • Ensured all modules build on all compilers, including the gdc packaged with gcc 9.
  • Put interactive unittest blocks into a new version(demos) so dub test works. These were in unittest to ensure documentation examples work, but being interactive meant tests were harder to run. Now it all works fine.

As a consequence of some of these changes, I also updated my adrdox doc generator to be able to read simple mixins, and extract declarations and documentation from inside them too. This new version is now on the site for dub packages, though I doubt that new thing will affect anyone else.

You might have noticed some outages this week too. That's in part because there were crashes in the search - naughty me used a __gshared inappropriately - and in part because I did a distro release update on the VM. All should be stable for the near future now.

Adam's rants

Directory layouts

I sometimes have people wanting me to add extra directories to my arsd repo, and I refuse since it would break the layout of my private ~/lib directory on my computer. And I realized this week my layout might be useful to other people too.

With my directory layout, I can go to ~/lib and git clone arsd and boom, just like magic, dmd -i can now find all those modules. I don't have to add additional paths to my compiler invocation nor move any files around. My simplified directory layout works with my simplified build process quite nicely.

I'm actually kinda tempted to make an alternative package manager for D that does something similar: automatically grabs some source and then reorganizes it into filenames and directories that match their module name in the source code. Then, you simply run dmd -i main.d and things just work when you import;.

But meh, I've managed to beat dub into working with my code lately, and my layout still works excellently for me, so probably not much use muddying the waters of dub.

Libraries, again

I was in a curious case recently wherein I was asked, for a technical assessment, to determine if a given integer, a is odd. I wrote (a&1) and moved on. When going over the assessment, they wanted to revisit this: how else might I do it?

Well, sure, sometimes I like to write out the ?true:false since I personally don't really like implicit conversions between int and bool and wish the language would restrict them, but no, that wasn't what they were getting at either. I gave up and just asked them for the answer they were looking for.

Their answer? "did you consider using a library?" I kid you not. I was momentarily dumbfounded - was this parody? But instead of saying that out loud, I laid out my philosophy on libraries: they can be useful, but not necessarily. They always come with various costs, including cognitive load (what, exactly does that function do? i have to ask that a lot during debugging sessions), dependency management and associated risks, and library code is still code and thus has a maintenance burden. These costs need to be weighed the benefits, and in this case, it is a clear loser to simply writing the code inline. If they didn't say "integer" originally, I might have done it differently... but they did so this way is pretty reasonable.

At least they accepted that explanation, but still, if this is modern innovation in software engineering, maybe I need to get out of this field.

If D ever had an isodd package, I would know all is lost in my beloved programming language.

wait a minute

*insert car crash sound effect here*

Sigh. lol