domn1995/dunet

Async match support

Closed this issue · 2 comments

I've been using the library in production code for a while now, and one use that would be useful is an async match method.

The use case here is when the matching logic is asynchronous due to a union being wrapped by a Task.

Should it be called MatchAsync() or just Match()?

Async Match Parameters

I'll put my 5 cents on that if you don't mind ;)
Async match will be extremely useful and fulfil the gap. Async methods are very common in many c# projects.

Should it be called MatchAsync() or just Match()?

I think MatchAsync will be closer to the standard convention in the .net world. Many (if not almost all) well-known .net libraries add *Async suffix to async methods. I think it's a good convention and helps reading the code (if you see the Async suffix you know that probably you want also the await keyword at the beginning, or you need special attention that depends on the case - and you can deduce all of this without the help from an IDE). Ergonomics shouldn't suffer too much with Async suffix IMHO.