First impressions of #golang
- the compilation speed is just insane. I often compile twice, because I don't believe.
- I'm not used anymore to such amount of mutability
- the syntax is meh
- having to deal with nil dampens enthusiasm
First impressions of #golang
- the compilation speed is just insane. I often compile twice, because I don't believe.
- I'm not used anymore to such amount of mutability
- the syntax is meh
- having to deal with nil dampens enthusiasm
@elan @arialdo Can’t speak to C#, but I have equivalent experience under my belt with Go and Java. The biggest win is treating errors as values and data, which yields ergonomic flow control with shallower nesting and more clear variable scope over exceptions: https://go.dev/blog/errors-are-values.
Merely checking whether the error value isn’t nil and returning is a picobrain approach. If you’re not using package errors or cmp, you’re designs are missing out.
@elan @arialdo Beyond keeping functions short, one technique to replicate the semantics is to inline anonymous functions in others with defer statements. It isn’t the most beautiful thing, but sometimes it is exactly what’s needed, especially when computing an output value.
To the extent it’s useful, there may be other gems in https://google.github.io/styleguide/go/. There are a lot of projects out there — notable ones — that do not model idiomatic design well.
@elan @matt I would never use exceptions and catches for handling custom errors: I believe using exceptions for controlling the application flow is an anti-pattern.
That said, an
actual, err
result to be checked after each function call seems to me equally very inconvenient.
Either<Error, Result> is the best option I could think of.
@arialdo @matt this is a #csharp implementation specific to #msftorleans
https://github.com/Applicita/Orleans.Results
The concept remains for any other language.
Concise, version-tolerant result pattern implementation for Microsoft Orleans 7 - GitHub - Applicita/Orleans.Results: Concise, version-tolerant result pattern implementation for Microsoft Orleans 7