Earlier quoted context omitted.
The biggest expressivity pain point in practice for me is try/catch not being an expression, so I can’t do const c = try { … }
Yes! This just drives me crazy: string something = null; try { something = mayThrow(); } catch (SomeException ex) { log.Info(ex); } catch (Exception ex) { log.Fatal(ex); throw; } if (something != null) { ... } Would be actually nice if it had F#'s try...with https://learn.microsoft.com/en-us/dotnet/fsharp/language-ref... and would allow us something like: var something = try { mayThrow() } with (SomeException ex) { l…
var something = (() => {
try {
return mayThrow()
} catch(SomeException ex) {
log.Info(ex);
return null;
} catch(Exception ex) {
log.Fatal(ex);
throw;
}
})();
Close enough?