-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve the handling of Outcome in V8 #1328
Comments
Maybe call it |
@martincostello Any suggestions for the method that returns How about this? public static ValueTask<Outcome<TResult>> FromResultAsTask<TResult>(TResult value) => new(Result(value)); Or maybe allow this syntax? Outcome.FromResult("some-value").AsValueTask(); |
FromResultAsTask is the best option, I think. |
For me the public static class Outcome
{
public static Outcome<TResult> FromResult<TResult>(TResult value) => ...;
public static ValueTask<Outcome<TResult>> FromResultAsTask<TResult>(TResult value) => ...;
public static Outcome<TResult> FromException<TResult>(Exception exception) => ...;
public static ValueTask<Outcome<TResult>> FromExceptionAsTask<TResult>(Exception exception) => ...;
} I think the |
Currently, the
Outcome<T>
is created as:In Polly V8 there are many places where the delegate need a function that returns ValueTask<Outcome>:
The syntax gets a little obscure so I am thinking how we can simplify this handling.
How about introduce the
Outcome
static class that will be used to create instances ofOutcome<T>
?Now the usage becomes:
We can take advantage of automatic type resolution. The constructors on
Outcome<T>
would be hidden and using theOutcome
static class would be the only way to create instances of generic outcome.This could also clean-up the V8 code a bit.
Contributes to #1324 and #1301.
@martincostello , @joelhulen, @PeterCsalaHbo Your thoughts, should I give this a shot?
The text was updated successfully, but these errors were encountered: