r/ProgrammingLanguages • u/jimbobmcgoo • Jul 23 '26
Will we see another fundamental programming language feature as revolutionary as the borrow checker?
That is I am mainly curious about compile time features that you design a whole language around rather than optimisations/features that could be applied to most languages. I am mainly inquiring about things that could offer additional robust safety/performance guarantees at compile time rather than runtime. Ideally not things that just offer similar effects to the borrow checker with less restrictive tradeoffs
61
Upvotes
View all comments
Show parent comment
2
u/matthieum Jul 24 '26
I think it's more than friction with the language, though.
In Rust, it falls out pretty naturally, and I tend to use for state machines. Since the method can consume
self, you can just add regular methods to a state (type), which returns a different state (type), and boom, session types.The problem, I've found, is that this only works "in the small". If you have a linear method -- even async -- then you do get thorough compile-time checking. On the other hand, as soon as you need to store the state and come back to it later, you tend to need type erasure -- such as wrapping in an enum -- and then there's no compile-time guarantee that on resumption you'll find the state as you expect, and so you've got a point of failure. The more points of failures you have, the less it seems worth it.