Add explicit type parameters to ignore functions
See original GitHub issueI’d like for ignore functions like AsyncResult.ignore (and perhaps ignoreError?) to accept explicit type parameters, just like F#'s ignore function.
My reasoning is that ignoring input is a “dangerous” operation under refactoring. For example:
doSomething |> ignore<int>
If you change doSomething so that it no longer returns int, then that may indicate that the code that previously ignored its result should now do something else with it. If you just specify ignore, you have to remember to check this yourself. If you specify an explicit type parameter, the compiler checks this for you and you have to decide in each case whether to ignore the new return type or do something else.
It is currently not possible to use explicit type parameters with e.g. AsyncResult.ignore because the definition does not use explicit type parameters. If this is changed, we can use explicit type parameters, e.g. AsyncResult.ignore<int, _>.
Issue Analytics
- State:
- Created a year ago
- Reactions:2
- Comments:5 (3 by maintainers)

Top Related StackOverflow Question
Cool, I didn’t know about that. But I don’t think we should force this on users.
Indeed they do. Did you mean that was relevant for the handling of this issue?
Edit: Of course, it is relevant in the sense that explicitly specifying the type to ignore would avoid that issue since it wouldn’t compile.