Things coming to Derw, Feburary 2023
I've been spending a lot of time implementing things in Derw, and thinking about what's missing. I tend to do this a lot. But I figured I would write down features that I have been experimenting with, thinking about, or generally consider might be added to the language this year. It's not an exhaustive list, and it will probably change. But anything on this list currently seems like a goal for Derw this year.
Type holes
If you haven't come across them before, type holes are a pretty neat feature. When you're uncertain what the implementation of a bit of code - or what a type might be, the compiler provides suggestions based on the surrounding type information, by the user indicating that there’s unsure what goes in a particular place with an underscore. Languages like Haskell and Idris have this - and it's super helpful and powerful, specifically for making development easier. This feature would be built into the language server. So I'd like to have something similar for Derw. It might end looking something like:
Type classes
While we're borrowing things from the more powerful ML languages, let's take one that people have been desperate for in Elm - type classes. Type classes allow you to define a set of functions that are standard across multiple different implementations - think of "map" applying not only to arrays, but also lists or any data structure which conforms to a similar structure. These have been excluded from Elm since the beginning, due to perceived complexity. And I mostly agree - they do tend to add a degree of complexity. Not only conceptually, but in terms of syntax and compiler implementation. I have now landed on how to do a happy and clean implementation, though I haven't landed on the syntax yet. Adding type classes ought to lead to a better type system, which is one of my current focuses.
TypeScript language server for interop
One of my plans from the beginning has been to use a combination of a Derw-specific language server with a TypeScript one to provide better error messages when doing interop between the two languages. My recent work with the Derw language server has put me in a better position to implement this - and hopefully the final result will lead to a seemless experience developing interop code.
Optimizing the web libraries and data structures
I have a dedicated blog post coming out for this soon, but I've spent a good amount of time in the last year looking into different ways Derw can be optimized. I don't want to be the fastest option out there - but it should be competitive. There should be only rare cases where the performance of Derw is not good enough, and that goes for size, speed, and bandwidth.
Importing packages from Elm and Gren
Right now there's an Elm generator inside Derw, so Derw can target Elm. It gets a bit tricky though since not all valid Derw (e.g interop) is valid Elm, and that will diverge more in the future. But the plan is to write an Elm parser in Derw so that all Elm code can be used in Derw - for example, using libraries written in Elm from Derw. The parser ought to be quite close to Derw's - with the same AST and only minor syntax changes. So I foresee this not taking long to implement at all.
A better package management solution
On the topic of packages, Derw's solution right now is an okay one. It's Git based and quite simple. But I'd love for packages to be discoverable through a central site -- additionally so that I can make the command line tooling for package management aware of the possible packages and their versions available.
Finish the Derw compiler rewrite
The compiler is currently about 50% rewritten in Derw itself - and I'm taking a pause on that implementation to focus on some more pressing things. But before I hit 1.0.0, I really want to get Derw fully self bootstrapped. A lot of the remaining code to port is quite complicated, so it will probably take a while for this one to be done.
Derw: the game
I'm quite excited about this idea - a game to introduce Derw to new users through encouraging interactive experimentation led by a tutorial in the form of a game world. Think of something similar to Human Resource Machine, where you are adjusting variables and functions in order to make some code work. If anyone is interested in helping out with this problem specifically, please reach out!
Closing notes
These are some of the things I find interesting and important, but there's a lot more planned. Currently in my backlog there's about 40 items planned and scoped out. I have a pretty effective workflow of picking things up either as I need to solve them, or just when I think I have time for a specific thing.
To stay up to date with more of Derw development, follow me on Twitter, star the Github repo, or follow the blog.