I've tried in Rust, and it requires a return definition, as do most mainstream functional languages.
Also, mainstream functional languages aren't truly mainstream: I'd struggle to find devs who could help me in consulting gigs.
I'm pretty sure that's just "administrative" and imposed by the syntax (e.g. think Java/C++ function declaration syntax), instead of being something the compiler can't infer. Thanks for clearing this up, though.
Re:Why We Chose Typescript
by steveklabnik on Saturday July 01, 2017 @01:10PM
(#14677903)
It was a design decision, yes. We could infer them if we wanted to, but we don't.
let rec factorial n =
if n = 0 || n = 1 then 1
else n * factorial (n - 1)
F#
Any of the mainstream functional languages (which are most likely to have type inference) can infer the types of all functions, unless you use funky language extensions that make type inference undecidable. Rust has a Hindley-Milner system, so it should be able to "infer recursive functions" too (but I can't say for sure since I don't use it).