4
$\begingroup$

Rust is famous for its ownership type-system, but requires the programmer to annotate ownership in function signatures. Is it possible to do full program inference of ownership, without any annotations? What would be the pros and cons of such a system?

New contributor
Olle Härstedt is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct.
$\endgroup$
  • 1
    $\begingroup$ The term you might be looking for is partial type inference. The reason why many languages don't have full type inference is that once you go beyond Hindley/Milner let-polymorphism, full type inference is generally undecidable. $\endgroup$ – Martin Berger 2 days ago
  • $\begingroup$ @MartinBerger No. Rust already has partial inference. This question is about full inference. $\endgroup$ – Olle Härstedt 2 days ago
  • $\begingroup$ I know that Rust has partial type inference. I was just clarifying terminology. $\endgroup$ – Martin Berger 2 days ago
  • $\begingroup$ As a general rule of thumb, any dynamic feature of a langauge (ownership at runtime, effects, shape of heap, what is printed out) can only be approximated by a type system that has algorithmic checking or inference, because questions about the dynamic behavior of programs get undecidable really fast. One always ends up balancing expressivity and simplicity. $\endgroup$ – Andrej Bauer 20 hours ago

Your Answer

Olle Härstedt is a new contributor. Be nice, and check out our Code of Conduct.

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.