OpenD at one year old

Posted 2025-01-01

One year ago, OpenD was created, forking off old D. It has been a smashing success thus far.

OpenD's accomplishments

  • IES (aka string interpolation) merged. Library support to use them to their fullest potential is still a work in progress.
  • Website started with a consistent theme throughout - and no more random ddoc macros
  • Automatic release bundles with ldc, dmd, opend build tool, and libraries all made on git push origin master with excellent reliability
  • foreach(int i, item; [array]) works again safely
  • Emscripten support added to druntime
  • Easy cross compilation with minimal setup - opend install xpack-emscripten and opend install xpack-win64 then opend --target=win64 just works.
  • Safer by default realized - a compromise that catches real bugs without being a real burden
  • mutable initializers common bug fixed
  • pragma(explicit_gc) added as a non-viral @nogc
  • @nogc functions can use gc stuff inside a if(__ctfe) block
  • __traits(resolveFunctionCall, overloadset, args...) for querying the compiler about overload resolution
  • Implicit casting and implicit construction implemented
  • Feature parity between dmd and ldc on Mac computers (linkerDirective, extern(Objective-C), @section)
  • Fixes in the module system, stonewalled upstream, deployed in OpenD
  • Octal literals added to the language
  • __traits(docComment)
  • private(this)
  • named unit tests
  • unittest=explicit
  • static foreach() static if(is(X Y)) just works, no redefinition errors
  • possible to do nogc allocator default arguments
  • tuple deconstruction added ahead of upstream w/ author's help
  • Several bug fixes including fixing regressions in -lib generated filenames, == null works with classes, and many dev process improvements (merging ldc and dmd repos, library support added, faster, more reliable automatic builds)

Works in progress with significant progress made:

  • global arena allocator stack
  • freestanding druntime
  • if(auto x; tryGet(x)) inspired by C#

There's a lot of work left we'd like to do, but this is better than I expected in the first year!

Learn more on the changes website https://opendlang.org/changes.html and by reviewing older blog posts here.

OpenD's impact on upstream

While the ideal outcome of an open source fork is to extract concessions from upstream, this was not a goal of OpenD, due to the odds of fruitful reconciliation being negligible. However, we have nevertheless had a significant impact on upstream as well:

  • Mere days after announcing our fork, the red tape around interpolated expression sequences that had held up the feature for years magically cleared up and the feature was merged.
  • OpenD's successful implementation of extern(Objective-C) feature parity between dmd and ldc prompted not just a backport, but a backport plus enhancement of the feature upstream, after lingering with no progress for nearly six years without us.
  • "Safe by default" has been listed as a desirable goal for at least nine years upstream when OpenD successfully made progress toward a "safer by default" only two months after forking. Shortly thereafter, upstream announced intention to follow us in concept, and they released it in December. Their version is, however, very different in key details than OpenD's successful innovation.

Upstream's impact on OpenD

While OpenD passes on most upstream patches, we have merged in some: several bug fixes, and a couple new features. We recently pulled their alias to member after doing some regression testing, and we merged their tuple deconstruction implementation - something that is in OpenD but not yet (and may never be) in upstream. We also took their local var ref functionality.

We continue to watch their progress - the beauty of open source is just because we're no longer restrained by their leadership doesn't mean we can't still take their good ideas and code.

Future plans

The roadmap on the opend website gives a rough outline of ideas: https://opendlang.org/roadmap.html but not everything there will bedone, some are just ideas to investigate.

The main thing on my mind right now is having more control over error messages. I'd like to be able to define user-defined warnings that are collapsed to a single message and can be acknowledged in user code to silence them in the future; things like pragma(warn, some_name, "Version 12 broke X"); and then the user code can say pragma(acknowledge, module.some_name); so it doesn't appear again while building. Similarly, I want to do some kind of pragma(allowDeprecated) in a statement to silence deprecation warnings in that scope to allow things like implementing fallbacks or reflection without spurious spam to the user.

Of course, I'd also love to make the normal error messages better, and have some ideas, like the indentation item on the roadmap.

OpenD's first year was split between getting the fork established (CI pain, download merging, website started) and catching up on things we've wanted to do for a long time, but was blocked upstream.

I think this second year is going to be more about solidifying what we have now. Finish library support that uses these new features from last year. Improve the end user experience - hence error messages - in using those libraries. And, of course, there's still plenty of work on the website still.

We'll see what actually happens though, like I often say, no promises, just like i said in the fork announcement, there's still a good probability that we'll fail.

PS: last year's section headings were from the video game "Perfect Dark". I actually played the game again recently. It still a good game, I remembered a lot, but forgot enough to make some of the levels interesting once more. Amazing how much more free time I have had this last year too.

Next blog post

I expect to catch up on arsd library developments next time I post here, a good chunk of stuff happened there too, another burst of development on minigui over christmas!