When you say 'algorithms would look better' this is pretty subjective. Graph based algorithms or inplace algorithms doesn't look too good in haskell.
Because it’s target domain requires reliable efficiency.
> Wouldn't it be better if we could just have the compiler guarantee that functions marked as such
As such what?
> are doing TCO
TCO is worthless, and Rust does not have TCE, nor does it care about TCE.
> so algorithms would look better and had the full benefit of persistent data structures?
Rust does not significantly care for persistent data structures, there are crates which provide them, but not the standard library.
Rust is not a functional language.
No, TCO is worthless, it’s an unreliable optimisation.
Context is relevant, the context here is language semantics, not things going faster.
TCO is fine to make things go faster, like inlining, unrolling, LICM, ....
TCO is hot garbage when you rely on it for program correctness.
Do you believe the exec system call is similarly unreliable at replacing your process image? Amazing that unix systems work at all
Then it's TCE not TCO.
> Do you believe the exec system call is similarly unreliable at replacing your process image?
Exec is entirely unlike TCO. If exec was a syscall which sometimes did and sometimes did not replace your process image, then it'd be like TCO, and it'd be similarly unreliable.
Why not? Why this "there can only be one" mentality?
Because you can't simply disallow mutability in an imperative language.
But about annotations, you annotate your code to let the compiler know what you meant to do. If just looking at what you do was enough, C would be a safe language. You improve it by giving more information to the compiler, so it can check if you are doing what you meant to.
(But I don't know what relation you saw with TCO. It's not a related concept.)
Maybe because it's designed to replace existing, familiar imperative and mutable languages.
Well you can use Rc/Arc (that’s what Bodil’s imrs does for instance), but essentially yes, by design and purpose a persistent data structure has confused ownership, and thus requires a separate layer handling memory reclamation.