Skip to content

Add explicit type parameters to ignore functions #173

@cmeeren

Description

@cmeeren

I'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, _>.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions