On Wed, Apr 20, 2022 at 3:30 PM Arthur Comte <ad...@arthurcomte.com> wrote:
>
> Actually, even with proper error handling, I still need to return a value. In 
> some functions I can just return a variable that was defined in the function, 
> but that is not always available. In those cases, the only solution I've 
> found is to use `*new(E)`, which seems plain terrible. Is there an 
> alternative? I'm guessing something is wrong with my angle

See 
https://go.googlesource.com/proposal/+/refs/heads/master/design/43651-type-parameters.md#the-zero-value

The easy is verbose way is

    var zero E

Ian

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/CAOyqgcVv9SuasqrCaJW97bmw%2BCv6Z4afHS6Sv-EUnfJ6HKj6wg%40mail.gmail.com.

Reply via email to