Darklang Release 9

Darklang Release 9 contains all the changes from December 2022. You can read more about the changes listed below in the Changelog, and check out our discussion and next month's planning on Youtube.

Short-circuiting boolean functions: && and ||

The big win for users is the new short-circuiting && and || operators. Darklang previously used functions for || and &&, which meant that both expressions were always evaluated. For example: if false && fireTheMissiles would have fired the missiles, and you can now avoid that unfortunate outcome.

Like all things in Dark, this change is backward-compatible. Old uses of the || and && function calls still work as they did before (as does copy-pasted code, calls to existing functions, etc), but are marked as deprecated. A built-in command called convert-to-short-circuiting can be used to automatically convert the old version to the new version.

New uses of || and && will use the short-circuiting versions by default. If you prefer the old version, you can call Bool::and and Bool::or directly.

This change turned out to be much bigger than expected and leveraged a lot of our recent internal work in ensuring we can carefully move the language forward without breaking existing user code, such as the "ClientTypes" and serialization testing work in Darklang Release 8. We feel really proud of our ability to change core language features such as the || and && operators without any risk to developers using Darklang!

Character-functions

Darklang has some character functionality built-in, and we're starting to expand it (a "character" in Darklang is a single screen-visible character, technically called an "Extended Grapheme Cluster"). We have added functions on characters, including:

  • Char::isUppercase_v0
  • Char::isLowercase_v0
  • Char::toUppercase_v1
  • Char::toLowercase_v1
  • Char::isDigit_v0
  • Char::isASCII_v0
  • Char::isASCIILetter_v0

We have also added the ability to add the Char type in function parameters and return types.

Other user-facing changes

We've started using a new font (Source Sans Pro) in places where the monospace font was inappropriate, which will become our new default font in the future.

We've also added List::partition_v0, expanding our experimental support for tuples, first discussed in Release 6.

Internal changes

We also had a lot of internal improvements. On the backend, we merged the old backend and fsharp-backend directories, started moving traces out of our DB and into Cloud Storage, removed old internal settings, and refactored match patterns to create room for upcoming let patterns. We've also added better serialization checking to prevent deploys which are not able to read user code (high risk: this would take the whole service down).

On the client, we have increased our usage of ReScript libraries for browser APIs, and increased our use of Tailwind.

Try it now

Sign up or sign in to try out all the recent changes.

You can help spread Darklang by discussing or upvoting on Mastodon, Twitter, HN, Reddit, Lobsters, Youtube, in our Discord (invite), or in the comments below!