Does _ (discard) not make sense for use! bindings?

77 Views Asked by At

It seems to me that there is an asymmetry here:

// Ok
use _ = { new IDisposable with member _.Dispose() = printfn "disposed" }

// Error! FS1288
use! _ = Async.OnCancel (fun () -> printfn "disposed")

How come there is this constraint imposed on the second use binding? Is it simply a case of "not spec'd and implemented yet" or is there a deeper reason?

Neither googling, nor binging FS1288 gave any helpful result.

1

There are 1 best solutions below

0
Brian Berns On BEST ANSWER

Allowing underscore in use bindings is a fairly recent addition to the language. There was apparently no discussion at the time of allowing it for use! bindings as well. Perhaps no one thought of it, and you could add it as a suggestion.

Related Questions in F#