-
Notifications
You must be signed in to change notification settings - Fork 3
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
Idiomatic C# - using switch for pattern matching: #262
Comments
|
At least for the Option type. I think I want to see an implementation to see the problems. |
I'd really like to see something like dotnet/csharplang#1047 implemented 😕… On a somewhat related note: We could make |
I am not very fond of matching true and false, but positional pattern sound great. var something = t.TryGetValue(out var value) switch
{
true => value,
false => -1,
}; |
Well you could use a ternary expression with var something = t.TryGetValue(out var value) ? value : -1; |
Making Option<IExceptionHandler> FindExceptionHandler(Exception exception) => ...;
try
{
...
} catch (Exception exception) when (FindExceptionHandler(exception).TryGetValue(out var handler))
{
handler.HandleException(exception);
} |
lang-ext goes the other way, and defines a functional way to Try. |
As long as it doesn't start polluting the stack trace too much… |
I've created a new issue for |
I like the idea to do pattern matching with the switch expression instead of our Match function:
louthy/language-ext#838
The text was updated successfully, but these errors were encountered: