Author Archives: Michael Parker

Interfacing D with C: Arrays Part 1

This post is part of an ongoing series on working with both D and C in the same project. The previous post showed how to compile and link C and D objects. This post is the first in a miniseries focused on arrays.

When interacting with C APIs, it’s almost a given that arrays are going to pop up in one way or another (perhaps most often as strings, a subject of a future article in the “D and C” series). Although D arrays are implemented in a manner that is not directly compatible with C, the fundamental building blocks are the same. This makes compatibility between the two relatively painless as long as the differences are not forgotten. This article is the first of a few exploring those differences.

When using a C API from D, it’s sometimes necessary to translate existing code from C to D. A new D program can benefit from existing examples of using the C API, and anyone porting a program from C that uses the API would do well to keep the initial port as close to the original as possible. It’s on that basis that we’re starting off with a look at the declaration and initialization syntax in both languages and how to translate between them. Subsequent posts in this series will cover multidimensional arrays, the anatomy of a D array, passing D arrays to and receiving C arrays from C functions, and how the GC fits into the picture.

My original concept of covering this topic was much smaller in scope, my intent to brush over the boring details and assume that readers would know enough of the basics of C to derive the why from the what and the how. That was before I gave a D tutorial presentation to a group among whom only one person had any experience with C. I’ve also become more aware that there are regular users of the D forums who have never touched a line of C. As such, I’ll be covering a lot more ground than I otherwise would have (hence a two-part article has morphed into at least three). I urge those for whom much of said ground is old hat not to get complacent in their skimming of the page! A comfortable experience with C is more apt than none at all to obscure some of the pitfalls I describe.

Array declarations

Let’s start with a simple declaration of a one-dimensional array:

int c0[3];

This declaration allocates enough memory on the stack to hold three int values. The values are stored contiguously in memory, one right after the other. c0 may or may not be initialized, depending on where it’s declared. Global variables and static local variables are default initialized to 0, as the following C program demonstrates.

definit.c

#include <stdio.h>

// global (can also be declared static)
int c1[3];

void main(int argc, char** argv)
{
    static int c2[3];       // static local
    int c3[3];              // non-static local

    printf("one: %i %i %i\n", c1[0], c1[1], c1[2]);
    printf("two: %i %i %i\n", c2[0], c2[1], c2[2]);
    printf("three: %i %i %i\n", c3[0], c3[1], c3[2]);
}

For me, this prints:

one: 0 0 0
two: 0 0 0
three: -1 8 0

The values for c3 just happened to be lying around at that memory location. Now for the equivalent D declaration:

int[3] d0;

Try it online

Here we can already find the first gotcha.

A general rule of thumb in D is that C code pasted into a D source file should either work as it does in C or fail to compile. For a long while, C array declaration syntax fell into the former category and was a legal alternative to the D syntax. It has since been deprecated and subsequently removed from the language, meaning int d0[3] will now cause the compiler to scold you:

Error: instead of C-style syntax, use D-style int[3] d0

It may seem an arbitrary restriction, but it really isn’t. At its core, it’s about consistency at a couple of different levels.

One is that we read declarations in D from right to left. In the declaration of d0, everything flows from right to left in the same order that we say it: “(d0) is an (array of three) (integers)”. The same is not true of the C-style declaration.

Another is that the type of d0 is actually int[3]. Consider the following pointer declarations:

int* p0, p1;

The type of both p0 and p1 is int* (in C, only p0 would be a pointer; p1 would simply be an int). It’s the same as all type declarations in D—type on the left, symbol on the right. Now consider this:

int d1[3], d2[3];
int[3] d4, d5;

Having two different syntaxes for array declarations, with one that splits the type like an infinitive, sets the stage for the production of inconsistent and potentially confusing code. By making the C-style syntax illegal, consistency is enforced. Code readability is a key component of maintainability.

Another difference between d0 and c0 is that the elements of d0 will be default initialized no matter where or how it’s declared. Module scope, local scope, static local… it doesn’t matter. Unless the compiler is told otherwise, variables in D are always default initialized to the predefined value specified by the init property of each type. Array elements are initialized to the init property of the element type. As it happens, int.init == 0. Translate definit.c to D and see it for yourself (open up run.dlang.io and give it a go).

When translating C to D, this default initialization business is a subtle gotcha. Consider this innocently contrived C snippet:

// static variables are default initialized to 0 in C
static float vertex[3];
some_func_that_expects_inited_vert(vertex);

A direct translation straight to D will not produce the expected result, as float.init == float.nan, not 0.0f!

When translating between the two languages, always be aware of which C variables are not explicitly initialized, which are expected to be initialized, and the default initialization value for each of the basic types in D. Failure to account for the subtleties may well lead to debugging sessions of the hair-pulling variety.

Default initialization can easily be disabled in D with = void in the declaration. This is particularly useful for arrays that are going to be loaded with values before they’re read, or that contain elements with an init value that isn’t very useful as anything other than a marker of uninitialized variables.

float[16] matrix = void;
setIdentity(matrix);

On a side note, the purpose of default initialization is not to provide a convenient default value, but to make uninitialized variables stand out (a fact you may come to appreciate in a future debugging session). A common mistake is to assume that types like float and char, with their “not a number” (float.nan) and invalid UTF–8 (0xFF) initializers, are the oddball outliers. Not so. Those values are great markers of uninitialized memory because they aren’t useful for much else. It’s the integer types (and bool) that break the pattern. For these types, the entire range of values has potential meaning, so there’s no single value that universally shouts “Hey! I’m uninitialized!”. As such, integer and bool variables are often left with their default initializer since 0 and false are frequently the values one would pick for explicit initialization for those types. Floating point and character values, however, should generally be explicitly initialized or assigned to as soon as possible.

Explicit array initialization

C allows arrays to be explicitly initialized in different ways:

int ci0[3] = {0, 1, 2};  // [0, 1, 2]
int ci1[3] = {1};        // [1, 0, 0]
int ci2[]  = {0, 1, 2};  // [0, 1, 2]
int ci3[3] = {[2] = 2, [0] = 1}; // [1, 0, 2]
int ci4[]  = {[2] = 2, [0] = 1}; // [1, 0, 2]

What we can see here is:

  • elements are initialized sequentially with the constant values in the initializer list
  • if there are fewer values in the list than array elements, then all remaining elements are initialized to 0 (as seen in ci1)
  • if the array length is omitted from the declaration, the array takes the length of the initializer list (ci2)
  • designated initializers, as in ci3, allow specific elements to be initialized with [index] = value pairs, and indexes not in the list are initialized to 0
  • when the length is omitted from the declaration and a designated initializer is used, the array length is based on the highest index in the initializer and elements at all unlisted indexes are initialized to 0, as seen in ci4

Initializers aren’t supposed to be longer than the array (gcc gives a warning and initializes a three-element array to the first three initializers in the list, ignoring the rest).

Note that it’s possible to mix the designated and non-designated syntaxes in a single initializer:

// [0, 1, 0, 5, 0, 0, 0, 8, 44]
int ci5[] = {0, 1, [3] = 5, [7] = 8, 44};

Each value without a designation is applied in sequential order as normal. If there is a designated initializer immediately preceding it, then it becomes the value for the next index, and all other elements are initialized to 0. Here, 0 and 1 go to indexes ci5[0] and ci5[1] as normal, since they are the first two values in the list. Next comes a designator for ci5[3], so ci5[2] has no corresponding value in this list and is initialized to 0. Next comes the designator for ci5[7].  We have skipped ci5[4], ci5[5], and ci5[6],  so they are all initialized to 0. Finally, 44 lacks a designator, but immediately follows [7], so it becomes the value for the element at ci5[8]. In the end, ci5 is initialized to a length of 9 elements.

Also note that designated array initializers were added to C in C99. Some C compiler versions either don’t support the syntax or require a special command line flag to enable it. As such, it’s probably not something you’ll encounter very much in the wild, but still useful to know about when you do.

Translating all of these to D opens the door to more gotchas. Thankfully, the first one is a compiler error and won’t cause any heisenbugs down the road:

int[3] wrong = {0, 1, 2};
int[3] right = [0, 1, 2];

Array initializers in D are array literals. The same syntax can be used to pass anonymous arrays to functions, as in writeln([0, 1, 2]). For the curious, the declaration of wrong produces the following compiler error:

Error: a struct is not a valid initializer for a int[3]

The {} syntax is used for struct initialization in D (not to be confused with struct literals, which can also be used to initialize a struct instance).

The next surprise comes in the translation of ci1.

// int ci1[3] = {1};
int[3] di1 = [1];

This actually produces a compiler error:

Error: mismatched array lengths, 3 and 1

What gives? First, take a look at the translation of ci2:

// int ci2[] = {0, 1, 2};
int[] di2 = [0, 1, 2];

In the C code, there is no difference between ci1 and ci2. They both are fixed-length, three-element arrays allocated on the stack. In D, this is one case where that general rule of thumb about pasting C code into D source modules breaks down.

Unlike C, D actually makes a distinction between arrays of types int[3] and int[]. The former is, like C, a fixed-length array, commonly referred to in D as a static array. The latter, unlike C, is a dynamic-length array, commonly referred to as a dynamic array or a slice. Its length can grow and shrink as needed.

Initializers for static arrays must have the same length as the array. D simply does not allow initializers shorter than the declared array length. Dynamic arrays take the length of their initializers. di2 is initialized with three elements, but more can be appended. Moreover, the initializer is not required for a dynamic array. In C, int foo[]; is illegal, as the length can only be omitted from the declaration when an initializer is present.

// gcc says "error: array size missing in 'illegalC'"
// int illegalC[]
int[] legalD;
legalD ~= 10;

legalD is an empty array, with no memory allocated for its elements. Elements can be added via the append operator, ~=.

Memory for dynamic arrays is allocated at the point of declaration only when an explicit initializer is provided, as with di2. If no initializer is present, memory is allocated when the first element is appended. By default, dynamic array memory is allocated from the GC heap (though the compiler may determine that it’s safe to allocate on the stack as an optimization) and space for more elements than needed is initialized in order to reduce the need for future allocations (the reserve function can be used to allocate a large block in one go, without initializing any elements). Appended elements go into the preallocated slots until none remain, then the next append triggers a new allocation. Steven Schveighoffer’s excellent array article goes into the details, and also describes array features we’ll touch on in the next part.

Often, when translating a declaration like ci2 to D, the difference between the fixed-length, stack-allocated C array and the dynamic-length, GC-allocated D array isn’t going to matter one iota. One case where it does matter is when the D array is declared inside a function marked @nogc:

@nogc void main()
{
    int[] di2 = [0, 1, 2];
}

Try it online

The compiler ain’t letting you get away with that:

Error: array literal in @nogc function D main may cause a GC allocation

The same error isn’t triggered when the array is static, since it’s allocated on the stack and the literal elements are just shoved right in there. New C programmers coming to D for the first time tend to reach for @nogc almost as if it goes against their very nature not to, so this is something they will bump into until they eventually come to the realization that the GC is not the enemy of the people.

To wrap this up, that big paragraph on designated array initializers in C is about to pull double duty. D also supports designated array initializers, just with a different syntax.

// [0, 1, 0, 5, 0, 0, 0, 8, 44]
// int ci5[] = {0, 1, [3] = 5, [7] = 8, 44};
int[] di5 = [0, 1, 3:5, 7:8, 44];
int[9] di6 = [0, 1, 3:5, 7:8, 44];

Try it online

It works with both static and dynamic arrays, following the same rules and producing the same initialization values as in C.

The main takeaways from this section are:

  • there is a distinction in D between static and dynamic arrays, in C there is not
  • static arrays are allocated on the stack
  • dynamic arrays are allocated on the GC heap
  • uninitialized static arrays are default initialized to the init property of the array elements
  • dynamic arrays can be explicitly initialized and take the length of the initializer
  • dynamic arrays cannot be explicitly initialized in @nogc scopes
  • uninitialized dynamic arrays are empty

This is the time on the D Blog when we dance

There are a lot more words in the preceding sections than I had originally intended to write about array declarations and initialization, and I still have quite a bit more to say about arrays. In the next post, we’ll look at the anatomy of a D array and dig into the art of passing D arrays across the language divide.

Symmetry Autumn of Code is Underway

Earlier this year, Laeeth Isharc brought an idea to the D Foundation for Symmetry Investments to sponsor a summer of code. He was eager to provide a few motivated individuals the incentive to get some great work done for D and the D community. Sporadic email discussions preceded some chatting at DConf 2018 Munich and the idea subsequently began to pick up steam. By the time the details were sketched out, it had transformed into the Symmetry Autumn of Code.

The SAoC projects

Eight applicants submitted their resumes and project proposals for three slots. Nearly all of the proposals were taken from the SAoC suggestions page at the D Wiki. Given the limited window, the selection process went fairly quick. Of the three selected, two had mentors attached. It took a little while to find a mentor for the third selection, so we extended the milestone deadline for that participant. Now I can happily say that all three are well underway.

A fork-based concurrent GC for DRuntime

Francesco Mecca proposed this project. The goal is to take Leandro Lucarella’s original D1 fork-based GC, port it to D2, adapt it to DRuntime’s GC interface, and culminate with a pull request for DRuntime to present the work and open discussion. Leandro agreed to mentor this project and is working with Francesco to develop a test suite that the port must pass as part of Milestone 2. They have also included documentation in their milestone list, which is good news.

vibe.d HTTP/2 implementation

This one came from Francesco Galla, who is currently pursuing a MSc in Network and Security. The goal here is to enhance the vibe-http library to support HTTP/2. Fittingly, Sönke Ludwig, the maintainer of vibe.d, agreed to mentor the project, but requested someone to share the load due to his schedule. Sebastian Wilzbach stepped up as co-mentor.

This project involves rewriting the current HTTP/1 API, ensuring it works as expected, then incrementally adding support for HTTP/2. Portions of the rewrite were already completed before SAoC came along, but had not yet been tested. As such, testing and bug fixing will be a significant portion of the first milestone.

Porting the Mago debugger to D

This project was proposed by László Szerémi. He’s a heavy user of debuggers in D and wants to see the situation improved. He believes that porting the Mago debugger to D is a major step in that direction. His first two milestones are concerned with translating, testing, and bug fixing. To cap off the SAoC event, he intends to get a GUI frontend up and running with some basic features.

László had no mentor when he applied, and no one had specifically volunteered to mentor any debugger projects, so we put out a call in the forums and I reached out directly to a few people. In the end, Stefan Koch agreed to take it on.

SAoC is not the end

I know that one of the goals Laeeth had behind his initial suggestion for this event was to enhance the D ecosystem. None of the selected projects are simple, one-shot tasks. These are projects which will all require attention, care, and effort beyond SAoC. The participants are getting them started and we hope they’ll continue to maintain them for some time to come, but in the end, these are projects for the community. When SAoC 2018 is behind us, it will ultimately be up to the community to determine if the projects live long and prosper or die young.

I’ll post more about SAoC and the participants as the event goes on. We wish them the best in meeting their milestones!

DMD 2.082.0 Released

DMD 2.082.0 was released over the weekend. There were 28 major changes and 76 closed Bugzilla issues in this release, including some very welcome improvements in the toolchain. Head over to the download page to pick up the official package for your platform and visit the changelog for the details.

Tooling improvements

While there were several improvements and fixes to the compiler, standard library, and runtime in this release, there were some seemingly innocuous quality-of-life changes to the tooling that are sure to be greeted with more enthusiasm.

DUB gets dubbier

DUB, the build tool and package manager for D that ships with DMD, received a number  of enhancements, including better dependency resolution, variable support in the build settings, and improved environment variable expansion.

Arguably the most welcome change will be the removal of the regular update check. Previously, DUB would check for dependency updates once a day before starting a project build. If there was no internet connection, or if there were any errors in dependency resolution, the process could hang for some time. With the removal of the daily check, upgrades will only occur when running dub upgrade in a project directory. Add to that the brand new --dry-run flag to get a list of any upgradable dependencies without executing the upgrades.

Signed binaries for Windows

For quite some time users of DMD on Windows have had the annoyance of seeing a warning from Windows Smartscreen when running the installer, and the occasional false positive from AntiVirus software when running DMD.

Now those in the Windows D camp can do a little victory dance, as all of the binaries in the distribution, including the installer, are signed with the D Language Foundation’s new code signing certificate. This is one more quality-of-life issue that can finally be laid to rest. On a side note, the cost of the certificate was the first expense entered into our Open Collective page.

Compiler and libraries

Many of the changes and updates in the compiler and library department are unlikely to compel anyone to shout from the rooftops, but a handful are nonetheless notable.

The compiler

One such is an expansion of the User-Defined Attribute syntax. Previously, these were only allowed on declarations. Now, they can be applied to function parameters:

// Previously, it was illegal to attach a UDA to a function parameter
void example(@(22) string param)
{
    // It's always been legal to attach UDAs to type, variable, and function declarations.
    @(11) string var;
    pragma(msg, [__traits(getAttributes, var)] == [11]);
    pragma(msg, [__traits(getAttributes, param)] == [22]);
}

Run this example online

The same goes for enum members (it’s not explicitly listed in the highlights at the top of the changelog, but is mentioned in the bugfix list):

enum Foo {
@(10) one,
@(20) two,
}

void main()
{
pragma(msg, [__traits(getAttributes, Foo.one)] == [10]);
pragma(msg, [__traits(getAttributes, Foo.two)] == [20]);
}

Run this example online

The DasBetterC subset of D is enhanced in this release with some improvements. It’s now possible to use array literals in initializers. Previously, array literals required the use of TypeInfo, which is part of DRuntime and therefore unavailable in -betterC mode. Moreover, comparing arrays of structs is now supported and comparing arrays of byte-sized types should no longer generate any linker errrors.

import core.stdc.stdio;
struct Sint
{
    int x;
    this(int v) { x = v;}
}

extern(C) void main()
{
    // No more TypeInfo error in this initializer
    Sint[6] a1 = [Sint(1), Sint(2), Sint(3), Sint(1), Sint(2), Sint(3)];
    foreach(si; a1) printf("%i\n", si.x);

    // Arrays/slices of structs can now be compared
    assert(a1[0..3] == a1[3..$]);

    // No more linker error when comparing strings, either explicitly
    // or implicitly such as in a switch.
    auto s = "abc";
    switch(s)
    {
        case "abc":
            puts("Got a match!");
            break;
        default:
            break;
    }

    // And the same goes for any byte-sized type
    char[6] a = [1,2,3,1,2,3];
    assert(a[0..3] >= a[3..$]);

    puts("All the asserts passed!");
}

Run this example online

DRuntime

Another quality-of-life fix, this one touching on the debugging experience, is a new run-time flag that can be passed to any D program compiled against the 2.082 release of the runtime or later, --DRT-trapException=0. This allows exception trapping to be disabled from the command line.

Previously, this was supported only via a global variable, rt_trapExceptions. To disable exception trapping, this variable had to be set to false before DRuntime gained control of execution, which meant implementing your own extern(C) main and calling _d_run_main to manually initialize DRuntime which, in turn, would run the normal D main—all of which is demonstrated in the Tip of the Week from the August 7, 2016, edition of This Week in D (you’ll also find there a nice explanation of why you might want to disable this feature. HINT: running in your debugger). A command-line flag is sooo much simpler, no?

Phobos

The std.array module has long had an array function that can be used to create a dynamic array from any finite range. With this release, the module gains a staticArray function that can do the same for static arrays, though it’s limited to input ranges (which includes other arrays). When the length of a range is not knowable at compile time, it must be passed as a template argument. Otherwise, the range itself can be passed as a template argument.

import std.stdio;
void main()
{
    import std.range : iota;
    import std.array : staticArray;

    auto input = 3.iota;
    auto a = input.staticArray!2;
    pragma(msg, is(typeof(a) == int[2]));
    writeln(a);
    auto b = input.staticArray!(long[4]);
    pragma(msg, is(typeof(b) == long[4]));
    writeln(b);
}

Run this example online

September pumpkin spice

Participation in the #dbugfix campaign for this cycle was, like last cycle, rather dismal. Even so, I’ll have an update on that topic later this month in a post of its own.

Three of eight applicants were selected for the Symmetry Autumn of Code, which officially kicked off on September 1. Stay tuned here for a post on that topic as well.

The blog has been quiet for a few weeks, but the gears are slowly and squeakily starting to grind again. Other posts lined up for this month include the next long-overdue installment in the GC Series and the launch of a new ‘D in Production’ profile.

Funding code-d

At the DConf 2018 Hackathon, I announced that the D Language Foundation would be raising money to further the development of the suite of tools comprising code-d, the Visual Studio Code plugin. The project is developed and maintained by Jan Jurzitza, a.k.a. Webfreak001.

The plan was that if we reached $3,000 in donations on our Open Collective page, we’d make the money available to Jan. When we finally reached the goal, I was quite happy to tweet about it:

Jan and I still hadn’t finalized the details at that point, but we finally got it all sorted a few days later. Before I show how we’ll be using the money, I’d first like to talk about why we’re doing this.

The motivation

As the D programming language community has grown, so has the amount of work that needs to be done. Since D is a community-driven language, much of the work that gets completed is done by volunteers. Unfortunately, the priorities for those who actively contribute aren’t necessarily aligned with those of everyone else, and this can lead to some users feeling that there is little progress at all, or that their concerns are being deliberately ignored. That’s just the nature of the beast. More potential pain points and unfulfilled wishlists means there’s a continual need for more manpower.

Therein lies one of the most fundamental issues that has plagued D’s development for years: how can more people be motivated to directly participate so we can keep pace with the consequences of progress?

To be clear, everyone involved in the core team is aware that lack of manpower is not the only negative side effect we suffer from growth, but it is certainly a big one. Part of my role these days is to figure out, along with Sebastian Wilzbach, ways to mitigate it. My inbox is littered with conversations exploring this topic, along with recommendations from Andrei to research how other projects handle one thing or another for inspiration.

To that end, in early February I launched the #dbugfix campaign with the goal of increasing community participation in the bug fixing process by providing a simple way for folks to bring attention to their pet peeve issues (keep it going people – participation has slowed and we need to pick it up!). We also announced the State of D Survey, initiated by Seb, at the end of February to get an idea of what some of the personal pain points are and where people think things are going swell. We’ve got other ideas in development, one of which I’ll be telling you about in the coming days.

Among the data that jumped out at us from the survey is that Visual Studio and Visual Studio Code were the most popular IDEs/editors among participants. The plugins for both Visual Studio (Visual D) and VS Code (code-d/serve-d/workspace-d) are each maintained by solo developers.

That’s a heavy workload for each of them. Look at the issues list for code-d and you’ll find several there (39 open/132 closed as I write), but the PR list is much shorter (1 open/21 closed as I write). What I infer from that is that the demand for improvements is higher than the supply for implementing them. And from personal experience, I know there are projects like code-d whose maintainers would love to add new features, or improve existing ones, but simply can’t (or aren’t motivated to) make the time for it.

Here then is a good place for a little experiment. What if the D Language Foundation started raising money to help fund the development of specific projects like code-d? By creating the opportunity for those with extra money but little time to directly contribute toward fixing their personal pain points and shrinking their wishlists, can development be focused toward getting bugs fixed and improvements implemented more quickly?

Long story short, I picked the VS Code plugin for our trial run because it was prominent in the survey data, it’s cross-platform, and the serve-d component can be beneficial to other IDE/editor plugins. Open Collective launched their goal system just as I was trying to determine how best to go about it, so it seemed the obvious choice (though we didn’t learn until after our announcement that it wasn’t the system we thought it was, i.e. it’s not a system of multiple, targeted fund raising goals but instead a milestone on the global donation progress bar at the top of our Open Collective page). I contacted Jan just before DConf to gauge his interest, then finally had a meeting with the Foundation board the night before the Hackathon to get approval and decide how to go about doling out the money (we decided the money should be paid out in increments based on completion of milestones, with the option to provide money as needed for targeted development costs, e.g. a Windows license, bug bounties, etc). It all came together fairly quickly.

We plan to continue this initiative and raise money for more work in the future. Some will be like this trial run, with the goal of motivating project maintainers to focus development and spend that extra hour or two a day to get things done. Some will be aimed at specific development tasks, as bounties or as payment for a single part-time or full-time developer. We’ll experiment and see what works.

We won’t be using Open Collective’s goals for this (or any other service) going forward. Instead, we’re going to add a page to the web site where we can define targets, allow donations through Open Collective or PayPal, and track donation progress. Each target will allow us to lay out exactly what the donations are being used for, so potential donors can see in advance where their money is going. We’ll be using the State of D Survey as a guide to begin with, but we’ll always be open to suggestions, and we’ll adapt to what works over what doesn’t as we go along.

As long as there are people willing to put either time or money into the D language, community, and ecosystem, this will surely pay off in the long run with more visible progress, hopefully solving a wider range of pain points than currently happens in our “what-I-want-to-work-on” system of community development. We’re looking forward to see the synergy that results from this and other initiatives going forward.

The milestones

Jan has some specific ideas about how he wants to improve his plugin tools and was happy to take this opportunity to put them all front and center. I asked him to make a list, then estimate how much time it would take to complete each task if he were working on it full time, then divide that list into roughly equal milestones of 3–4 weeks each. That does not mean he will be working full time, nor that each milestone will take 3–4 weeks; payment is not dependent on deadlines. It was simply a means of organizing his task list.

We ended up with two sets of tasks as a starting point and agreed to a $500 payout upon completion of both milestones. Once all the tasks in a milestone are completed, the $500 will be paid. At the end of the second milestone, we’ll determine what to do next – another milestone of feature improvements, a heavy round of bug fixing, or something else – and how to make use of the remaining $2000.

Following is a list of the tasks in both of the initial milestones, with a brief description of each directly from Jan (lightly edited).

Improvements & maintainence

  • add automated tests for windows 7, 10, archlinux, ubuntu, fedora, osx for startup, from scratch project initialization, reloading, adding dependencies
    There are automated tests in the workspace-d repo which test different scenarios and combinations with dub, DCD, and d-scanner, ranging from general usage to weird setups. Identifying more issues (especially on windows), creating more tests and especially running all the tests on several platforms would be a good first step towards a less buggy version of serve-d which should work on all platforms equally well.
  • Single file mode
    A requested feature and one which makes the usage of the plugin a lot easier would be single file usage. Currently, single file usage is very limited and without an open workspace it doesn’t work at all. Adding this (with quick startup time and low resource usage) will make code-d a good alternative to vim or notepad for quickly editing a D file.
  • fix unknown DDoc macro parsing
    Currently, if any unknown DDoc macros are used, they are omitted from the documentation renderer, which makes some documentation unreadable and weird. For this, libddoc needs to be worked on by identifying where exactly the macros are discarded, how they could be kept track of, and how to make it more obvious in the API without breaking backwards compatibility.
  • project template creator as separate plugin (with standardized template format if possible)
    Currently the “Create Project” command is a very static command reading from a directory in the plugin. Making this a separate VS Code plugin with an API for other plugins to extend with more functionality would make it more flexible and open it to new platforms and APIs. Also, research on if there are already some standards for this and if we can parse other template formats.
  • detect used imports & add command to remove unused ones & add Remove unused imports + sort command
    Add a way to find out if imports are used and add a command to remove unused ones. DCD could probably be extended for this.
  • code folding on grammar
    The expand/collapse feature on arrays & functions (bracket based) and lambdas. (Instead of indentation based)
  • parse dub commandline arguments
    Dub command line arguments should be able to be passed into the build buttons and future tasks. This will require parsing them because dub is used as an API and not as a program.
  • experiment with adding a mode to DCD to make all symbols available
    A mode to always give all public symbols regardless of imports and additionally provide the import where the symbol comes from (so when completing it, the IDE adds an import)

UX & Tools for beginners

  • improve UI/UX for building and running projects (implement tasks api) 
    As the tasks API is now actually released, I can incorporate the different build types into the task system of VS Code. This would include having build (debug, release), run, test for each detected dub project and submodule.
  • make workspace symbol search show more symbols
    The workspace symbol search (Ctrl-P -> #) currently is using just DCD to find exact matches for types. I would include DScanner ctag/etag results in this response to make the search better.
  • code action: improve implement interface (parse existing functions and not include them)
    Test cases need to be written, existing interfaces must be parsed, cross-file it should all still work, inherit documentation, etc. Need to check in real world applications where interfaces and classes are used. Also add support for abstract classes.
  • auto complete in diet templates (both HTML tags and D code)
    Add static HTML auto completion for tags & attributes and create a virtual D file for D code for DCD for autocompletion.
  • code action: create getter/setter for variable
    For code like int _foo;, create the property functions int foo() @property const { return _foo; } int foo(int value) @property { return _foo = value; } with automatic detection if const can be used. This makes writing classes easier (snippets already exist, but this is more intuitive) and shows beginners how properties are created. The property should be added where other properties are. It could check the comments for “Getters”, “Setters” and “Properties” if possible, otherwise just put it after a block of members.
  • code action: convert boolean parameter to Flag (+import)
    This should change the definition of a function void foo(bool createDirectory) to alias CreateDirectory = Flag!"createDirectory"; void foo(CreateDirectory createDirectory) and add the appropriate import if it doesn’t exist yet.
  • code action: make foreach parallel (with import if neccessary)
    Replace a foreach (a; array) with foreach (a; parallel(array)) and import std.parallelism.
  • code action: convert enum to bitflag enum (isBitFlagEnum assert + modify values)
    Convert any enum enum Foo { a, b, c } to enum Foo { a = 1 << 0, b = 1 << 1, c = 1 << 2 }, add static assert(isBitFlagEnum!Foo); and import std.typecons if neccessary.
  • search for unknown symbol or import online
    Use dpldocs.info. Example: import mongoschema; -> Error importing -> Search online code fix -> Add dub package mongoschemad, etc. For undefined symbols the same: check local projects for symbols, otherwise see if online providers know anything.
  • show local references from DCD & local rename
    Highlight a symbol in the document when hovering on a member and provide the ability to rename it (not cross-file, because DCD doesn’t support that).

Thank you

Thanks again to all of the donors who pushed us over the goal line for this. Though we realize not everyone will be entirely pleased with the milestone list, and that it would have been better if we had finalized everything before asking for donations rather than coming at it haphazardly like we did, we hope that most of you find more here to like than not.

It will be a little while yet before we set up the new system and announce the next goal, as we’ve got other initiatives taking priority at the moment. So please be patient. We haven’t forgotten about the State of D Survey, nor are we going to let the results sit and bitrot. This train may be slow sometimes, but it’s rolling on.

DMD 2.081.0 Released

DMD 2.081.0 is now ready for download. Things that stand out in this release are a few deprecations, the implementation of a recently approved DIP (D Improvement Proposal), and quite a bit of work on C++ compatibility. Be sure to check the changelog for details.

Improving C++ interoperability

D has had binary compatibility with C from the beginning not only because it made sense, but also because it was relatively easy to implement. C++ is a different beast. Its larger-than-C feature set and the differences between it and D introduce complexities that make implementing binary compatibility across all supported platforms a challenge to get right. Because of this, D’s extern(C++) feature has been considered a work in progress since its initial inception.

DMD 2.081.0 brings several improvements to the D <-> C++ story, mostly in the form of name mangling bug fixes and improvements. The mangling of constructors and destructors in extern(C++) now properly match the C++ side, as does that of most of D’s operator overloads (where they are semantically equivalent to C++).

Proper mangling of nullptr_t is implemented now as well. On the D side, use typeof(null):

alias nullptr_t = typeof(null);
extern(C++) void fun(nullptr_t);

The alias in the example is not required, but may help with usability and readability when interfacing with C++. As typing null everywhere is likely reflexive for most D programmers, nullptr_t may be easier to keep in mind than typeof(null) for those special C++ cases.

Most of the D operator overloads in an extern(C++) class will now correctly mangle. This means it’s now possible to bind to operator overloads in C++ classes using the standard D opBinary, opUnary, etc. The exceptions are opCmp, which has no compatible C++ implementation, and the C++ operator!, which has no compatible D implementation.

In addition to name mangling improvements, a nasty bug where extern(C++) destructors were being placed incorrectly in the C++ virtual table has been fixed, and extern(C++) constructors and destructors now semantically match C++. This means mixed-language class hierarchies are now possible and you can now pass extern(C++) classes to object.destroy when you’re done with them.

Indirectly related,  __traits(getLinkage, ...) has been updated to now tell you the ABI with which a struct, class, or interface has been declared, so you can now filter out your extern(C++) aggregates from those which are extern(D) and extern(Objective-C).

The following shows some of the new features in action. First, the C++ class:

#include <iostream>
class CClass {
private:
    int _val;
public:
    CClass(int v) : _val(v) {}
    virtual ~CClass() { std::cout << "Goodbye #" << _val << std::endl; }
    virtual int getVal() { return _val; }
    CClass* operator+(CClass const * const rhs);
};

CClass* CClass::operator+(CClass const * const rhs) {
    return new CClass(_val + rhs->_val);
}

And now the D side:

extern(C++) class CClass
{
    private int _val;
    this(int);
    ~this();
    int getVal();
    CClass opBinary(string op : "+")(const CClass foo);
}

class DClass : CClass
{
    this(int v)
    {
        super(v);
    }
    ~this() {}
    override extern(C++) int getVal() { return super.getVal() + 10; }
}

void main()
{
    import std.stdio : writeln;

    writeln("CClass linkage: ", __traits(getLinkage, CClass));
    writeln("DClass linkage: ", __traits(getLinkage, DClass));

    DClass clazz1 = new DClass(5);
    scope(exit) destroy(clazz1);
    writeln("clazz1._val: ", clazz1.getVal());

    DClass clazz2 = new DClass(6);
    scope(exit) destroy(clazz2);
    writeln("clazz2._val: ", clazz2.getVal());

    CClass clazz3 = clazz1 + clazz2;
    scope(exit) destroy(clazz3);
    writeln("clazz3._val: ", clazz3.getVal);
}

Compile the C++ class to an object file with your C++ compiler, then pass the object file to DMD on the command line with the D source module and Bob’s your uncle (just make sure on Windows to pass -m64 or -m32mscoff to dmd if you compile the C++ file with the 64-bit or 32-bit Microsoft Build Tools, respectively).

This is still a work in progress and users diving into the deep end with C++ and D are bound to hit shallow spots more frequently than they would like, but this release marks a major leap forward in C++ interoperability.

DIP 1009

Given the amount of time DIP 1009 spent crawling through the DIP review process, it was a big relief for all involved when it was finally approved. The DIP proposed a new syntax for contracts in D. For the uninitiated, the old syntax looked like this:

int fun(ref int a, int b)
in
{
    // Preconditions
    assert(a > 0);
    assert(b >= 0, "b cannot be negative");
}
out(result) // (result) is optional if you don't need to test it
{
    // Postconditions
    assert(result > 0, "returned result must be positive");
    assert(a != 0);
}
do
{
 	// The function body
    a += b;
    return b * 100;
}

Thanks to DIP 1009, starting in DMD 2.081.0 you can do all of that more concisely with the new expression-based contract syntax:

int fun(ref int a, int b)
    in(a > 0)
    in(b >= 0, "b cannot be negative")
    out(result; result > 0, "returned result must be positive")
    out(; a != 0)
{
    a += b;
    return b * 100;
}

Note that result is optional in both the old and new out contract syntaxes and can be given any name. Also note that the old syntax will continue to work.

Deprecations

There’s not much information to add here beyond what’s already in the changelog, but these are cases that users should be aware of:

The #dbugfix campaign

The inaugural #dbugfix round prior to the release of DMD 2.080 was a success, but Round 2 has been much, much quieter (few nominations, very little discussion, and no votes).

One of the two nominated bugs selected from Round 1 was issue #18068. It was fixed and merged into the new 2.081.0 release. The second bug selected was issue #15984, which has not yet been fixed.

In Round 2, the following bugs were nominated with one vote each:

I’ll hand this list off to our team of bug fixing volunteers and hope there’s something here they can tackle.

Round 3 of the #dbugfix campaign is on now. Please nominate the bugs you want to see fixed! Create a thread in the General Forum with #dbugfix and the issue number in the title, or send out a tweet containing #dbugfix and the issue number. I’ll tally them up at the end of the cycle (September 28).

And please, if you do use the #dbugfix in a tweet, remember that it’s intended for nominating bugs you want fixed and not for bringing attention to your pull requests!

DConf 2018 Ex Post Facto

When I was ten years old, I broke a small hand mirror. For some years after, my moderately superstitious grandmother would remind me of it any time I suffered a bit of misfortune, providing me with periodic updates on how many of my seven years of bad luck I had yet to face. Two days before DConf 2018, I couldn’t help but think of her when my wife and I, having encountered a black cat the evening before, found ourselves in the wrong train car at Frankfurt station.

The train

It was an easy mistake to make. We were supposed to be in car 28, so we boarded at a door that was branded “38/28”. Inside, 2nd class was to the right and 1st class to the left. Our reservation was for the latter. We found our seats, stowed our luggage, and settled in for our trip to Munich and DConf. It was a few minutes before I noticed the big “38” on the screen of the monitor hanging from the ceiling.

I asked the first uniformed person I could find, “Are we in the right place?”. Of course, we weren’t. He informed me we couldn’t just cut through the cars to get to the correct place — we had to disembark and get back on at the other end of the train. Only, there was no time to do so, as the train was leaving in a few seconds.

“Don’t worry,” he said. “It happens.”

When the conductor came around, he assured us that all was well. The seats weren’t reserved and the whole train was going to Munich anyway. I laughed, thinking the last bit was a joke. I later learned that two trains are sometimes linked to share part of a journey and will split somewhere along the way to head to different final destinations. He was being serious!

The pre-conf jitters

A Toastmasters class I won in an essay contest after high school cured me of my fear of public speaking (prior to that, I couldn’t say two words in front of five people without going into convulsions), and after 24 years of teaching in Korea I’m perfectly comfortable speaking to groups of a few people in a small class or a few hundred at an assembly. I always know what I want to say and I’m confident in my ability to read the crowd. So when I accepted the offer to be the DConf emcee this year, I wasn’t concerned at all. Short bursts of speaking in front of 80 people? I could do that in my sleep.

But the train incident was the first in a series of unfortunate events that continued right up until a few minutes before the conference, including two embarrassing instances of my mishearing introductions and thinking a person I’d just met was someone else. By the time I had the mic in my hand, I could hear my grandmother’s voice in my head, reiterating every bit of “bad luck” I’d had since that cat had crossed my path in Frankfurt (it was actually a kitten, not entirely black, and my wife had found it adorable enough that she briefly entertained ideas on how to take it with us to Korea).

Of course, I’m not superstitious. At all. But apparently my lizard brain felt these were extraordinary circumstances. As Walter and I were chatting while we waited for the clock to countdown, I was attacked by the worst case of jitters I’ve had since high school.

It was going to be the worst DConf ever.

The conference

After the first few words were out of my mouth, the jitters evaporated. My grandmother left me alone for the rest of the conference. Barring a few minor glitches and one rather severe one, it all went rather well, though I couldn’t really tell from my perspective.

This was my first time being on the other side. Everything went by in a blur. During the talks, there were emails and Facebook messages to respond to, IRC & the livestream feed to check in on (though Sebastian Wilzbach kept a fulltime eye on them), tweets to write, and the constant concern about how to politely keep speakers in their time budget. Without the Foundation’s intern, Maria Marginean, running the mic to audience members with questions, I would have been frazzled.

Between talks, there were problems getting speakers’ laptops to display properly, questions about things I didn’t immediately have an answer for, and people to track down to resolve one issue or another. Then there were the numerous things I had planned to say each time I got up in front of everyone, only to realize after I sat back down that I had completely forgotten.

In all, I had a great time. I had less time to mingle this year, but I still caught up with some familiar folks and met several new ones. That’s always the best part of DConf for me, and that held true this year, even though many of the conversations I had were brief.

The display issues turned out not to be as troublesome as they threatened to be on the first day. The A/V team was using a bluetooth device. Plug it in to a USB port, install a driver, press the big button on the device, and you’re projecting. But a few speakers had no USB ports, some were using Linux (for which there was no driver), and some struggled to get the proper desktop to display. On the second day, the A/V guys were prepared with every adapter imaginable and, where those failed, they simply unplugged the HDMI cable from the bluetooth receiver and plugged it directly into the laptops. We still had problems sometimes with the wrong desktop showing, but in the end it all worked out.

The biggest glitch, the one we regret most of all, was the loss of the video of the first three talks. It’s something that could have been prevented with a bit of forethought. The best thing I can say about it is that it taught a valuable lesson that will be applied at future DConfs. No matter who is organizing or who is managing the A/V, the Foundation will ensure steps are taken to minimize the chance of this happening again.

In the periods that I was able to pay attention to the talks, there was a lot to enjoy.

Vang Le presented on D in genomic bioinformatics.

We’ve heard in the forums about D being used in bioinformatics, but this year was the first time we’ve witnessed a DConf talk about it. The talk sparked enough interest in the subject that Vang Le was able to get some collaboration at the Hackathon that will hopefully continue beyond as he works to expand D in the field. I look forward to seeing more talks related to this industry at future conferences.

In contrast, the topic of game development is a DConf staple (DConf 2015 was the only edition without a gamedev talk). But this year was the first time someone from Ubisoft presented (Igor Česi), and the first we’ve learned about a project some folks from the company took on as a proof-of-concept, porting D to a platform Igor wasn’t allowed to name just yet. I’ve been interested in game development as a hobby for over a couple of decades now and I don’t get to meet too many game developers in my normal line of work (the first time I met Ethan Watson in Berlin I grilled him mercilessly about his job throughout dinner), so the conversation the trio from Ubisoft had with Andrei and me (mostly Andrei) about the company and their interest in D was one of the highlights of the conference for me.

Another highlight for me was meeting Martin Odersky, our invited keynote speaker this year. I’ve followed Scala from a distance for some time; it was the first place I turned when I needed to correct my lack of experience with functional programming after std.algorithm and friends came along. Our introduction was a bit rushed, though. Five minutes before he was supposed to speak, he wasn’t anywhere in or around the conference room. Walter hadn’t seen him. Andrei hadn’t seen him. Someone reported seeing him in the restaurant. That’s where I found him, banging away at the keys on his laptop. He had realized at breakfast that his talk about abstracting over context needed a bit more context to make it more understandable, given how most of us wouldn’t have the Scala background he referenced. He was just finishing his edits as I arrived, and we got him set up right on time. I ignored my emails and FB messages for most of that talk (and actually understood quite a lot of it).

Martin Odersky was the invited keynote speaker on Day 3.

Some DConf veterans talked about work they’ve been doing, like Jonathan Davis’s dxml library, Ethan Watson’s progress on Binderoo, Dimitry Olshansky’s report on his attempt to create a unified concurrent D runtime, and Steven Schveighoffer’s experience porting a LAMP application to vibe.d. Johan Engelen expanded on a blog post he wrote earlier this year, presenting a talk on some LLVM-backed goodies in LDC that people might not be aware of.

Kai Nacke talked about using D for the blockchain.

Kai Nacke presented another first for DConf, a talk about D for the blockchain, where he did a great job simplifying a complex topic. Luís Marques’s talk on breaking away from OOP orthodoxy was immediately followed by first-time DConf speaker Jean-Louis Leroy’s related talk on open methods. And live-ask.com, the subject of Stefan Dilly’s presentation on scalable webapp development in D with Angular and vibe.d, was actually put to use during the conference — it became our primary source for taking questions online, particularly during Walter and Andrei’s Ask Us Anything session at the end of Day One.

The D Language Foundation’s scholarship recipients (a.k.a. Andrei’s Students, a.k.a. The Romanian Crew) were back to present updates on their work. We heard from Razvan Nitu on the trials and tribulations of contributing to DMD, Eduard Staniloiu on a new approach to generic collections in D, and Alexandru Jercaianu on Project Blizzard, a means of performing safe memory allocation and deallocation in D. The first two of those talks came on Day Two, which was opened by Andrei’s keynote. He had been scheduled to present on static introspection, but changed his mind and instead did a deep dive on things that are vital to D’s future in a talk titled, “Up and Coming”.

Of the three talks for which we have no video, a version of Walter’s keynote on using D in existing C codebases will be available eventually – he gave the same talk at Code Europe Kraków not long after DConf. The picture is not as rosy for the other two talks. Mario Kröplin and Stefan Rohe presented an entertaining report on their experience using D for 10 years at Funkwerk and Jon Degenhardt used his first DConf talk to update us on the performance of eBay’s TSV utilities, following up on a blog post he wrote for the D Blog on the same topic. Sadly, the videos for those talks are forever lost.

Evidence that Jon Degenhardt really did give a talk about eBay’s TSV utilities.

We did another round of lightning talks this year. It was organized as the conference progressed, and given that everyone was using their own laptops, I was sure that trying to get them shifted on and off the lectern and properly configured would be a disaster. In the end, it all came off successfully. A couple of presenters went over their five-minute time budget and two were unable to get their displays configured, but we had just enough time to get everyone in and the display-less folks improvised and presented without their slides anyway.

Liran Zvibel (whose name I can now absolutely properly pronounce) wrapped up the last full day of talks with a closing keynote. He regaled us with a report on Weka.IO’s experience with D in the development of their storage system. It was followed the next day by Shachar Shemesh’s announcement of Mecca, Weka.IO’s container/reactor library, to kick off the Hackathon. Actually, after Shachar saw that a significant number of the audience didn’t raise their hands when I asked how many would be sticking around for the Hackathon, he requested a slot in the lightning talks for an early, abbreviated announcement.

At the Hackathon, we had audio in the room for Shachar’s talk but no video, so I set up a livestream from my MacBook (though it has poor audio quality). Ali Çehreli made sure it kept rolling and he repositioned it as needed. After the talk and the group photo (which Andrei missed!), I saw a lot of folks with their heads together, but I only know of what a couple of them were doing (maybe we’ll hear more about that in future blog posts).

The big announcement at the Hackathon was that the D Language Foundation will now start funding projects via targeted donations. The VS Code plugin code-d (and its companion, serve-d) is the first project selected. Once we achieve $3000 in donations, the project maintainer will be eligible to get that money as he meets specific milestones. Unfortunately, the new goals system at Open Collective isn’t what we expected it to be. We’ll make do with it for now, but we’ll likely be moving to an approach that allows us to set up multiple fundraising targets and count donations through Open Collective, PayPal, and elsewhere. Until then, if you’re a code-d user (or just want to support the project), head to our Open Collective page to show your appreciation and make a financial contribution to its development.

Videos of the talks are starting to appear on HLMC’s YouTube channel. Once they’re all online, we’ll set up a playlist on the D Language Foundation’s channel (you can find playlists of all the previous conferences there now).

Until next year…

Thanks to everyone who attended DConf 2018 in Munich, to everyone who supported it with time or money, and to QA Systems and HLMC Events for putting it all together.

Some of the DConf 2018 crew.

It’s too early to say where DConf 2019 will be hosted, but plans regarding some of the generic organization details are already in the works. I expect some announcements will start coming out a little bit earlier than in the past. Stay tuned!

The #dbugfix Campaign: Round 1 Report

The D Foundation released version 2.080.0 of DMD on May 2nd. That normally would have been accompanied by a blog post highlighting some of the items from the changelog. This time, it should also have included the first update on the #dbugfix campaign. I was on vacation with my wife in the days before and after DConf and never got around to writing the post. It’s a bit late to announce the DMD release now, so this post is instead all about the first round of #dbugfix.

I admit, my initial expectations of participation were low. I suppose I didn’t want to be disappointed. Happily, in the end I had no reason to be pessimistic. There were several issues “nominated” on Twitter and in the forums. I was also pleased that some of the forum posts led to substantial discussion. In fact, at least one of the forum threads led to one of the nominated bugs being fixed well before the period ended, and the fix was included in the 2.080 release.

The results

The following issues were nominated, but were fixed before the nomination period ended. #5227 is the only one I’m certain was fixed as a result of discussion from the #dbugfix campaign. The others might have been, or they may have been fixed in the normal course of activity.

The following issues were open at the time the bug fixers selected which two issues to focus on, along with the “vote” count (+1’s, retweets, or anything which indicated support for fixing the issue) as best as I could determine:

The mandate for the bug fixers is to select at least two of the top five. Of course there has to be some leeway here, given that some issues are extremely difficult to resolve, so they can look beyond the top five if they need to. In this case, given that all of the issues share only four distinct vote counts, the entirety of the list is in play anyway.

I got the bug fixers together before I headed off to my (spectacular) German vacation and asked them to come to a consensus by May 1st on two bugs to fix (I must note that they met their deadline, even though I did not). The two bugs selected were:

There are no time constraints on when these will be fixed. It is hoped that they will be fixed and merged in time for 2.081.0, but they could come in a later release. The point is, each of these is now a subject of attention.

Some details regarding a few of the issues not selected:

  • re: 15692 – a while back, Sebastian Wilzbach revived an old DIP for in-place struct initialization and is part way through an implementation.
  • re: 1983 – there’s an old PR waiting for a champion to revive it.
  • re: 18493 – Mike Franklin has a PR that’s waiting on clarification about whether or not nothrow should be implicit with -betterC.

Keep it going

Now that it’s done, I’m happy to declare the inaugural round of the #dbugfix campaign a success. I had hoped that asking for nominations in the forums would as an alternative to Twitter would spark discussions and am pleased to see that happened. So let’s build on this and keep it going.

The slate was wiped clean and the votes reset from the day I declared the first round finished on April 24th. I haven’t noticed any nominations since then (though I haven’t searched for any yet), but please keep them coming. If there’s an issue on the above list that’s not yet fixed but that you feel strongly about, nominate it again. Or nominate something not on the list that’s stuck in your craw. If you see a nomination on Twitter that you support, retweet it to add your vote. In the forums, give a +1 reply. Keep it going!

And while you’re nominating your issues, keep in mind that fixing bugs is only part of the story. If you really care about seeing issues fixed, please try your hand at reviewing pull requests. Contributors whose fixes languish in the PR queue are demotivated from contributing more, but without more eyes reviewing the PRs, the bandwidth to speed up the reviews isn’t there. More PR reviews beget more merges beget more closed issues beget more motivated contributors and satisfied users.

Barring a change in release schedule, DMD 2.081.0 should be released July 1. This round of nominations will close at the beginning of the last week of June. So tweet out or open a new forum thread for your #dbugfix nominee today. Please include both the #dbugfix hashtag and the bugzilla issue number in the tweet or post title, along with a link to the issue report. That will make my job considerably easier.

And review some PRs!

Thanks to Sebasitan Wilzbach and Mike Franklin for their help with this, particularly in keeping me updated with info about PR and DIPs!

Communal Benevolence Required

DConf 2018 is coming up fast. The final pieces of preparation are soon to fall into place and then the day will be upon us. Already, we’re looking at what comes next.

We recently put out a survey to gather a good deal of feedback from the community. At that time, we promised that the survey results would be used to guide some initiatives going forward. Though we’ve been silent on that front, it’s still in the works. You should be hearing an announcement at DConf about the first such initiative, and a subsequent blog post will lay out the framework we’ll be following going forward.

One thing all of our initiatives will have in common is that they will require resources. That, unfortunately, is not something the D Language Foundation has in large quantities. Whether we’re talking about time, money, or manpower, D’s development is constrained by the limited resources available. Fortunately for us, one can be used to drum up the other two, so in the absence of enough folks able to donate their time and manpower, we’ll be relying on donations of money to buy what we need to meet the community’s goals.

The same holds for DConf. In order to keep the registration fees relatively affordable, reimburse the speakers, buy the T-shirts, and fund all of the costs associated with the event, the Foundation uses money from the donation pool to cover what the registrations don’t. That’s exactly the sort of thing the donations are for, of course, but the more we dip into the pool for the conference, the longer it takes to replenish after.

So if you’re looking to help the D community, this is an excellent way to do it. You can head over to our OpenCollective page, or choose one of the alternatives on our donation page at dlang.org, and throw a few dollars at us. Leave a note on the donation form letting us know you’re doing this to support DConf 2018.

As a reminder, if you haven’t registered for DConf and aren’t planning to, the Hackathon on May 5th is open to all. So if you’re in the area that day, come on in and see us!

Announcing the DConf 2018 Hackathon Pass

As I write, General Admission for DConf 2018 in Munich has been open for one week. The conference runs from May 2–5, with three days of talks capped off by a day-long Hackathon. We’ve heard there are some in the area who would like to attend, but just can’t get away from work for three days for the full conference. So we’ve decided to do something about it.

This year,  the Hackathon is open, free of charge, to anyone interested in hanging out with us on Saturday, May 5th, the final day of the conference. You’ll have to bring your own lunch, but you’ll get access to the full day. This time around, it’s more than just hacking on and talking about D code.

We’ve added one more new item to the list this year: the Hackathon will be kicked off with a talk by Shachar Shemesh from WekaIO. His talk, Announcing Mecca, introduces the company’s open source D project to the world, a perfect way to get us started on an event intended to motivate hacking on open source D projects.

Last year, our inaugural Hackathon was a great success. It’s not a hackathon in the traditional sense, but an opportunity for D programmers to come together and spend the day working on the projects that they think matter, improve the D ecosystem, or learn more about D programming.

Any attendee with an open source D project is welcome to seek out collaborators to help them get work done on site, or to hunker down and help others hack features and bug fixes into their own projects, or any project in the D ecosystem. Some may simply want to sit and code by themselves, getting instant feedback from others on site when it’s needed, and that’s fine, too. Last year’s event proved to be quite a productive day, particularly for the core D projects.

Those not in the mood for coding, or who aren’t yet up to speed on D programming, are covered, too. Last year, groups gathered to hold brainstorming sessions on ideas for new projects, or for solving complex issues in the core. Others, D’s BDFL Walter Bright among them, took some time during the day to tutor less experienced D programmers, on specific language features and other programming topics, in informal sessions that came about because a few people sitting near each other started asking questions.

In short, the DConf Hackathon is a day of getting things done in a friendly and collaborative environment full of people with shared interests. It’s a loosely organized event, the direction of which is determined by those participating. We’ll throw some ideas out there for you to work on if you need the cues, but you’re free to go your own way.

Last year’s Hackathon fell on a Sunday, and some of the conference attendees had to skip it or leave early in order to get back home for work on Monday. This year, it’s on a Saturday, so we hope that if you weren’t able to stick around last year you can do so this time around.

If you’ve never been to a DConf or don’t know much about the D language, the Hackathon Pass is a great remedy for both ailments. So if you’re in or near Munich Saturday, May 5th, we invite you come on by and hear about a great new open source project, spend a day with a friendly crowd of interesting people, and learn a little about the D programming language in the process.

DConf 2018 Programme & Open Registration

The programme for DConf 2018, May 2–5 in Munich, has been published and general registration is now open.

As always, we’ve got keynotes from Walter and Andrei, and an invited guest speaker, this time in the form of Martin Odersky, professor at EPFL and creator of the Scala language. Our closing keynote comes in the pleasant shape of Liran Zvibel, CEO of WekaIO. In between we’ve got another strong lineup of speakers this year, covering a number of topics from the familiar to the new.

We’ve got experience reports, both commercial and personal, web app development, design methodology, the runtime, tooling, and more. Two topics not seen at DConf before include using D for blockchain application development and in genomic bioinformatics. Some of the Foundation’s scholarship students are back for their progress reports, we’ve got our traditional round of Lightning Talks, and Walter and Andrei will be taking the stage in an Ask us Anything session at the end of Day One!

Don’t forget, we’re running another Hackathon this year. Those who stick around on May 5 (and we hope everyone does) can get together for the morning and afternoon sessions to mingle, talk, hack, and squash bugs. It’s not a hackathon in the traditional sense, but one that is driven by those who attend. Find D coders to help you with your projects, contribute to other D projects, hack at some bugs from the D bug tracker, brainstorm ideas for making the D programming experience better… just go where it takes you.

21 hours of talks and an all-day Hackathon are nothing to sneeze at, but there’s much more to DConf than that. It’s the meetup of meetups for members of the D community, a chance to put faces to names and establish real-world relationships with those we’ve only met online. It’s an opportunity to introduce the language to those who don’t know it well and welcome them into the community. Some of the best DConf memories are made in between the talks, in the restaurants at dinner, and in the hotel lobby, where you’ll find an ongoing stream of interesting and intelligent conversation. And don’t forget the great German beer!

So book your flights and your rooms, pack your bags, and register for Four Days of DLang at DConf 2018 in Munich!