Re:Programming Idioms
by Thiez on Monday August 16, 2021 @09:12AM
(#28197618)
I think it can be useful for initialising properties and fields, where you are not allowed to use `var` (for good reason, if you ask me). But of all the recent features it's the one that I would miss least if it were taken away.
[ Parent
| on HN ]
Fair point! Although I wish they had found a way to add F# style global inference rather all these little tricks
I suspect type inference becomes pretty tricky in the presence of subtyping.
I don't have any F# experience, but I have done some Haskell back in the days and I found the type inference very convenient. But I also think there is something to be said for limiting type inference to "inside" methods where it is effectively invisible to users of a class. Rust has made the same choice: you have type inference inside functions, but never outside.