Dark Deep Dive: From Editor to Infrastructure in Less Than 50 Milliseconds
For an introduction to Dark, see “Dark, a New Programming Language for ‘Deployless’ Deployments.”
To describe Dark, self-dubbed “a language built for deployless backends,” as merely a programming language may sell short the grand aspirations of the project that ostensibly intends to consolidate several aspects of the software lifecycle into an environment where syntax errors no longer exist, infrastructure doesn’t require a second thought, and the time from code to production is less than 50 milliseconds.
In a company statement announcing Dark’s move from private alpha to private beta, Dark is more appropriately described as “a holistic programming language, editor, and infrastructure for building backends,” a sentiment shared with The New Stack by Dark co-founder Paul Biggar.
“Dark encapsulates more than a traditional language would. The key thing about Dark is that it incorporates the infrastructure as well, so another way to think about this is that it occupies the space that’s taken by AWS or Heroku or Google Cloud. You don’t need to think about it, you can just write code and we handle the infrastructure for you,” said Biggar. “Our intent for Dark is that it’s an infrastructure compiler. Because we have all of this information about how your program runs — we have the traffic, we have the code, we have the data — we can make decisions about what is the best architecture for your application at that moment in time and automatically build it up for you.”
While Biggar admits that Dark is still early on in its life — “today’s implementation is quite different than that, in much more of an early stage,” he said of Dark’s infrastructure compilation abilities — the topic is one that Biggar has put much thought into as a former founder and CEO of continuous integration and continuous delivery (CI/CD) platform CircleCI. Biggar has laid out the team’s aspirations for Dark in a lengthy blog post, describing a language that lives entirely online, from the IDE to the deployment, which is immediately usable in production the moment it’s typed into the Web-based IDE.
There are a couple of key design choices that make Dark what it is: it operates using the Abstract Syntax Tree (AST) directly, it uses feature flags for everything from its own versioning to different versions of your code, and it doesn’t have a parser, which Biggar calls “an interesting thing about Dark.”
“In typical compilers and interpreters, the parser creates an AST. It’s the thing that takes the text from a file and turns it into the actual representation that shows what the language means. It has a fancy name, but it’s a very simple concept,” said Biggar. “What Dark does instead is that the editor operates on the AST directly. That means that when you type in the editor, we’re making transformations directly on the AST and that allows us to do stuff that’s really powerful. It very much simplifies a large part of how the infrastructure works. I don’t think it would be really possible to do the 50 millisecond deploy without that.”
On whether Dark is a compiled language or not, Biggar said that there is no visible compiler to the user. “You just write the code and then 50 milliseconds later it is running. The implementation of that today is that Dark is interpreted. The future implementation is that Dark will first be interpreted and then it will be compiled with a just-in-time compiler.”
While Dark may just now be entering private beta, the company says that it already has customers that have shipped entire products on Dark, such as Altitude, a subscription SaaS providing personalized flight deals, and Birb, a project tracking tool.
Beyond being “deployless,” Dark is also error-less — at least in terms of syntax. Biggar explains that, while your code may fail to do what you intend, it will run nonetheless.
“Syntax errors are errors that the parser highlights. So, if you don’t have a parser, you can’t have a parser error,” said Biggar. “You can create an AST you didn’t want to create, but everything that you create will be a valid AST and there won’t ever be a hunt for the semicolon problem.”
CircleCI is a sponsor of The New Stack.
Feature image via Pixabay.