On Saturday, we had our third contributor meetup, this one was organized by Shahriyar Nasir (thanks Shah!). This time, we did mob coding to add a Tuple type to Dark, and we recorded the whole thing.

A tuple looks like this:

let x = (somevar, "a string", 567)

A tuple allows you to combine multiple values of different types. In the video, we added Tuples to the editor and frontend, including in particular the keystrokes to add, update, and delete tuples. Shah followed up later to add backend support. We hope to get this merged soon.

The video is about two hours, which is about how long it takes to add a language feature to the frontend (it probably takes a similar amount of time to add a feature to the backend). This was straightforward as Tuples have a very similar interaction model to Lists - hopefully other language improvements won't take too much longer.

Note that if you're interested in contributing other language features, the issues have a good list of what we need.

Now that tuples exist in the language, we still have make them more usable. We need functions to get the contents, such as Tuple2::getFirst, Tuple2::getSecond, etc. This also highlights that we need to support destructuring: while we currently support destructuring some expression types in pattern matches, we don't support that in let statements. We support:

match someNumber
  Ok 5 -> 6
  Ok 6 -> 7
  Ok num -> num + 1
  Err msg -> 0

But we don't support:

let Ok num = someNumber

There are quite a lot of functions in Dark that could return Tuples, where we've hacked support using other methods. For example, request.headers uses a dictionary (as does the header parameter in HttpClient::get), DB::getAllWithKeys_v2 returns a dictionary, and List::zip returns a list of two-element arrays. These would much more naturally use tuples.

Overall, this is part of fleshing out the language, in order to allow us to build new features without having to hack around an incomplete language. We'll be doing more of this in the next few months.

You can sign up for Dark here, and check out our progress in these features in our contributor Slack or by watching our GitHub repo. Follow Dark on Twitter, or follow the blog using RSS.