DConf 2020 announced: June 17-20 in London. @safe by default debated. Adam did: Android, JNI, WebSocket in arsd libs

Posted 2020-01-06

DConf 2020 was announced this week. It will be on June 17-20 in London, rather than the May we've traditionally done. On the newsgroup, @safe by default was debated.

On @safe by default, Walter feels it is essential, Atila said it is important for the strategic direction of the language. Support among the community was split, especially out of fears of code breakage. I'm concerned it will just make D feel like a "fight the compiler" language but right now leaning toward small net benefit toward it... but I'm kinda meh.

Walter also said he wants to do nothrow by default, and I'm against that, but we could perhaps get some useful alternatives to exceptions well-supported alongside. We'll be in for a fight.

I also did more open source code too, which I'll discuss below.

Core D Development Statistics

In the community

Community announcements

See more at the announce forum.

Android Update

I wrote the setup program and it is on github now. Can download binaries for druntime and adjust ldc2.conf for you to point at the NDK. Still needs to be tested for Windows and Mac but looked good so far. Makes using it as simple as running the program then just building your stuff for the android architectures.

WebSocket client

I started a websocket client in my arsd.http2 library. Basic functionality works, though event loop integration is still pending, and it doesn't correctly handle continuation frames (large websocket messages) - will fix both next time I get time to work on it.

The event loop integration will be interesting. My dependencies policy means I can't just import an interface... but that's basically what I want to do. I expect I will do a C-style vtable you integrate via .tupleof assignments. Or something. Or maybe I'll break the rule and add an interface; this is probably justified here, though that's a breaking change in several libraries (terminal, simpledisplay, http2, cgi). Maybe I can make it opt-in.

BTW I have never actually used websocket. My server in cgi.d was based on a draft spec and never updated... now it is getting updated but I'm finding bugs. It was so bad. I personally prefer using regular POST and server-sent events for most applications but it will be nice to have this too.

(The websocket support code btw is another duplication between http2 and cgi. But meh. Maybe I'll factor that out with an opt-in with websocket version too. We'll see.)

JNI stuff

I'm working on changing the code generator now to include interface parents. It is tricky because Java interfaces include one feature that D doesn't: default implementations. Working around that has been kinda tricky with automatic generators. (Trivial by hand though: you just write the @Import declaration in the class itself. Then it works. But the auto generator has a hard time knowing that's supposed to work. I have a few ideas so don't give up yet.)

I also fixed the case of returning a class with lazy imports by simply making the implementation import already import the return type implementations too. Not ideal - for ideal do it by hand! - but convenient.

Lastly, I got a surprisingly huge compile time speed up with one minor change: instead of mixin(item.replace(...)), I did static immutable x = item.replace(...); followed by mixin(x). This way the compiler wouldn't rerun the CTFE string replace every time, and instead cached it.

CTFE string appends and replaces are surprisingly huge in dmd memory and compile time.