4 ms·
Just as an anecdote, the fact that Haskell does this (infers type signatures for functions) is one of the things I don't like about it, because it seems to ofte
by sanderjd 10y ago
Just as an anecdote, the fact that Haskell does this (infers type signatures for functions) is one of the things I don't like about it, because it seems to often infer things that are surprising to me. I think inferring types in most places, but enforcing explicit types at the level of method definition strikes a really good balance. I care about the types required to satisfy interfaces, but enjoy not needing to care so much in implementations.
IDE support for creating method signatures by inferring types would be neat though.
- MichaelGG 10y agoHaskell _allows_ it. The programmer decides if they want it. Requiring a full signature inhibits natural code writing by introducing a high amount of overhead per function. Writing a 1-line inner function is no longer an obvious win. The annotation requirement applies to nested functions in Rust.
- untothebreach 10y agoI don't really understand this issue. If I write a one line function in rust, nested within another function, I will use a closure. Which, incidently, rarely requires me to annotate any types.
- sanderjd 10y agoI can choose to use explicit type signatures for functions I write, but I can't choose to use them for all the functions I read. I read a lot more than I write. We also may just disagree about what constitutes a "high" amount of overhead. Thinking about the contract of my method does not seem like overhead to me; I have to do that anyway.