You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I just ran into a problem where closure parameter types needed to be annotated to get the code to compile. The issue hasn't seen much activity, and I'm not sure whether it's expected behavior or not. But I'd like to check in on this when I'm editing the closures chapter to see if we need to dial back a bit on some statements' absoluteness, like:
Closures don’t require you to annotate the types of the parameters or the return value like fn functions do.
Within these limited contexts, the compiler is reliably able to infer the types of the parameters and the return type
As with variables, we can add type annotations if we want to increase explicitness and clarity at the cost of being more verbose than is strictly necessary.
The text was updated successfully, but these errors were encountered:
I have run into this from time to time as well, often when returning Results from a closure. I still think it's rare enough we don't have to add more weasel words, but it couldn't hurt :)
I just ran into a problem where closure parameter types needed to be annotated to get the code to compile. The issue hasn't seen much activity, and I'm not sure whether it's expected behavior or not. But I'd like to check in on this when I'm editing the closures chapter to see if we need to dial back a bit on some statements' absoluteness, like:
The text was updated successfully, but these errors were encountered: