christophilus
3 months ago
Every time I tinker with languages like Rust or Crystal or Swift, I am amazed by their compilation times. OCaml and Pascal got this right aeons ago. I’m looking forward to a public release of Jai simply because compilation speed is one of its primary motivations. Having a fast feedback loop is crucial to my adhd-like development workflow.
Someone
3 months ago
> I am amazed by their compilation times. OCaml and Pascal got this right aeons ago
Pascal doesn’t do type inference at all.
I think OCaml meets both of the non-goals mentioned in the article:
“There are also two non-goals worth mentioning:
Removing overloading from the language. Without disjunction constraints, a constraint system can almost always be solved very quickly. However, this would be such a major change to the language, and break so many existing APIs, that it is not feasible to attempt at this point, even as a new language mode.
Removing bidirectional inference. We can also imagine a language design where expressions are type-checked in a strictly bottom-up fashion, starting from the leaves, like in many other C-family languages. This is another drastic simplification that essentially trivializes the whole problem. However, this would require giving up on language features such as polymorphic literals, leading-dot member syntax, closures with inferred types, and parts of generics. All of these are features that make Swift into the expressive language it is today.”
So, both are fast because they do less. Given that Apple hasn’t managed to make the Swift compiler even somewhat swift (pun intended) I think that partly is the right choice.
christophilus
3 months ago
> So, both are fast because they do less.
Great. Give me that with a modern toolchain and a good stdlib, and I’ll be one happy dev. Swift focused on solving the wrong problem. I don’t need overloading or bidirectional inference. I need fast compilation, good tooling, and a solid stdlib.
undeveloper
3 months ago
isn't rust's compilation speed slow primarily due to its reference / lifetime checker, rather than the "actual compilation" of the program?
Measter
3 months ago
Not even close. Borrow checking takes less time than type checking.
amluto
3 months ago
On a somewhat related note, Swift has a particularly nifty type erasure system that allows it to avoid monomorphizing everything, and I think some Rust people would appreciate if such a system magically appeared for Rust. As I understand it, implementing it would be a lot of work.