Andrei Andreev
Andrei Andreev
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/freeze
Being similar to LINQ brings a benefit of less steep learning curve for new developers. I think it might be worth considering, though the library tends to be F#-like, so...
Apparently, the [F# analog](https://fsharp.github.io/fsharp-core-docs/reference/fsharp-core-optionmodule.html#defaultValue) is also called `defaultValue`, so `GetValueOrDefault` is fine I guess. I like the idea of adding `GetXOrDefault` and `GetXOrThrow` as **members** as opposed to them being...
@vkhorikov Wouldn't it be better to have `GetValueOrThrow` instead of the `.Value`? It would be more consistent with `GetValueOrDefault` and wouldn't give a programmer a false sense of safety which...
After giving a bit of thought to `GetValueOrThrow()` and `GetValueOrDefault()`, I figured that these operators are the railway end - you can use them to exit the `Result` execution scope....
Yeah, I agree that moving `OnFailureCompensate` to `Result` is a bad idea. I'm talking about the approach (or philosophy) here: if we give a user a way to exit the...
@vkhorikov Technically, `Result.Value` is `Unit` (or `void`). If one would want to compensate into some default value in `Result` to bring them from `Error` to `T`, then it only makes...
@vkhorikov ```csharp Result ConnectToServer() { } void StartOfflineMode() { } ConnectToServer().OnFailureCompensate(StartOfflineMode); ```
What do you think about proper naming then?
Good idea, and we should probably also use `NotNullIfNotNullAttribute` for `GetValueOrDefault` https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/attributes/nullable-analysis#conditional-post-conditions-notnullwhen-maybenullwhen-and-notnullifnotnull