It's been two months since module support landed in Stabel with the 0.2.0 release. Since then, I've been busy re-factoring the compiler, trying to improve the foundations before adding more features for the 0.3.0 release.
Because of this, 0.2.1 isn't a very exciting release but it does bring some improvements worth talking about.
Better error messages
A lot of effort has gone into making error messages much more understandable. You now get a good description of every error the compiler throws at you, with a file reference, line number and relevant source code. There is still room for improvement here, but we've improved leaps and bounds since the 0.2.0 release.
As far as I know there are no working stabel programs in existance, so why bother? Good error messages are easier to achive if they're a fundemental language design feature, so they need to be considered from the very beginning. We now have a good foundation to build off on, which I believe will pay off in the future.
Compiles with the elm --optimize flag
A lot of effort was focusing on eliminating uses of Elm's builtin Debug.todo function. This function causes the program to crash, and prevents certain kinds of optimization. It's also not possible to publish packages to the Elm package repo if your code makes use of Debug.todo.
So why did Stabel make use of this function at all? The way the Stabel compiler was written, meant we had several cases that in theory could not happen. In order to get the program to type check, I either had to add some silly code that made no sense other than to the Elm's type checker, or use Debug.todo.
In 0.2.1, I've refactored the code to follow a guiding principle in Elm: make impossible states impossible. There's a great talk from Richard Feldman which describes this principle in detail, so I won't go into it here. What I will say is that through this re-factoring, the Stabel compiler's code is now easier to read, faster and safer.
Interestingly, there's now nothing to prevent us from publishing the Stabel compiler as an Elm package.
Bugs, bugs, bugs...
During the course of working with this release, I also completely re-wrote the test suite. As a result, it detected a lot more bugs. The type checker, specifically, has seen a lot of work and much more correct code should now type check.
Looking forward to 0.3.0
Now that we've improved the foundations, it's time to start working on the next big features of the Stabel language. In the next couple of days, maybe weeks, I'll post language proposals to describe these new shiny features in detail, and collect feedback on them.
If you want to help out on getting the design of these features right, you can join our Zulip chat and be a part of the discussion when the language proposals land.