upstream release, delegate explicit_gc and disable ~this tips

Posted 2026-02-09

Two small tips and a comparison with upstream's latest release. I've been swamped with other work and unable to write much more, but I'll try to blog before too long talking about the new stuff in arsd. My super fairy princess game is pretty fun! lol

Tips of the week

Prohibit a struct from living on the stack

You can @disable a destructor, which de facto prohibits it from living on the stack:

// make a struct not try to auto destroy, prohibits living on stack in practice
@disable ~this();

opend still needs @disable(message)... but I haven't done much new compiler code lately, will add eventually.

Ensure no allocation from delegate

// to be sure a delegate doesn't allocate, pragma can be applied to statements
pragma(explicit_gc) const ch = (() @trusted => (te.text[idx]))();

Note this pragma is OpenD only.

Upstream released

After over nine months of no releases, upstream finally put something out. The new release has some features shared with opend:

__module in importC

opend allows one and only one module declaration in .c files. Upstream previously did not allow it at all, but in the new release, will allow any number of them, ignoring all but the first.

Awaiting in upstream beta: null pointer checks

Upstream also added null pointer errors to dmd beta, behind a preview switch. It was originally based on the opend impl, with bug fixes done later which we pulled back.

Rest has little overlap

Despite being the first release in nine months, there's not all that much else in it. The biggest changes are more druntime templatization - including several reported regressions. I remain skeptical of the benefits of this and OpenD will likely not merge any of this.