This post is part 3 of a series. Click here to go to the beginning of the series.| Considerations on Codecrafting
This post is part 2 of a series. Click here to go to the beginning of the series.| Considerations on Codecrafting
Programming, math, and other things gratuitously nerdy| Considerations on Codecrafting
In 2020, I released Cubiml, showing how to combine full type inference with structural subtyping in an ML-like language, and earlier this year, I followed it up with PolySubML, extending it with higher rank types and existential types among other features. For my next language (which I’ll call X here, since I haven’t chosen a name yet), I set the ambitious goal of supporting all of OCaml’s most notable functionality on top of everything PolySubML already supports. In this post, I will t...| Considerations on Codecrafting
Ever since Stephen Dolan’s 2016 thesis Algebraic Subtyping showed how to combine type inference and subtyping, I’ve been developing increasingly sophisticated programming languages based on those ideas, first IntercalScript in 2019, then CubiML in 2020, PolySubML in 2025, and with my next language already in the planning stages.| Considerations on Codecrafting
Programming languages typically support two different features for abbreviating complex types - type aliases and newtypes. However, type aliases lead to poor error messages and slow compile times, which is why I chose not to support them in my recently released language, PolySubML. In this post, I will explain the problems with type aliases and provacatively suggest that new languages should only support newtypes and stop supporting type aliases.| Considerations on Codecrafting
Programming, math, and other things gratuitously nerdy| Considerations on Codecrafting
Type inference has a reputation for causing unhelpful error messages from the compiler when there is a type error. For example, here’s a typical comment:| Considerations on Codecrafting
I’ve been using Rust for hobby projects since 2016 and have been working professionally in Rust since 2021, so I tend to consider myself pretty knowledgeable about Rust. I’m already familiar with all the common limitations of Rust’s type system and how to work around them, so it’s pretty rare that I have to “fight the borrow checker” as new Rust users often struggle with. However, it does still happen on occasion.| Considerations on Codecrafting
Here’s a quick puzzle: What does the following Haskell code print?| Considerations on Codecrafting
One of the first things any Rust programmer learns is that you can’t pass an object and a reference to that object around at the same time. It’s impossible to do, even indirectly. This limitation has been the subject of countless questions on Stack Overflow and posts on Reddit and the Rust forums and anywhere else where Rust programmers might ask for help. It’s so well-known that most people treat it like an axiom, not just a limitation of Rust as it currently exists, but an inherent li...| Considerations on Codecrafting
Back in 2020, I created Cubiml, a simple ML-like language that demonstrated how to extend the usual Hindley–Milner type system with subtyping while still having decidable full type inference. One question I got was whether it would be possible to support generalized algebraic data types (GADTs) in Cubiml. I had heard that GADTs break type inference and didn’t see the point, so I didn’t think much of it at the time.| Considerations on Codecrafting
Over the weekend, I was working on a personal Rust project when I ran into an excessive memory usage problem. After an evening of trial and error, I found a workaround to fix the memory usage, but I still didn’t understand how the issue was even possible, so I then spent another evening digging through the source code of the Rust standard library to understand the root cause.| Considerations on Codecrafting
Why do software bugs happen? There are many possible causes of bugs, but if we look at examples, we can hopefully see patterns in the bugs that arise and design our programming languages to rule out entire classes of bugs.| Considerations on Codecrafting
I am fortunate enough to work on a production Rust service (a real one, not cryptocurrency nonsense). Rust virtually eliminates the kinds of stupid bugs and gotchas that are endemic in other languages, making it much easier to develop and maintain our project. Unfortunately, Rust is substantially less capable when it comes to preventing the common issues involved in async programming. In fact, async programming is substantially harder to get right in Rust than in something like Javascript, du...| Considerations on Codecrafting