Dear, On Mon, Aug 31, 2020, 4:16 AM Zakaria bin Haris <z4k4...@gmail.com> wrote:
> Hi, gophers! > > Idk if this has been proposed or discussed before. > > Given the last error handling abbreviation proposal is rejected. How about > some simple syntactic sugar like this: > > *rin* Something() > I love the consistency and the one way of doing things. It's indeed boring to write 'if err ! nil', but I don't like the try catch either. Being explicit is actually nice and errors as part of return values is more easy to reason about. I would rather pollute my code with if err than having two ways for return. > Which is just a sugar for: > > if err := Something(); err != nil { > return err > } > > To make it worth the new keyword make it so that: > > *rin* v := Something() > > equals to: > > v, err := Something() > if err != nil { > return err > } > > -- > 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/955d78f2-67cb-4940-845c-034fb45e816an%40googlegroups.com > <https://groups.google.com/d/msgid/golang-nuts/955d78f2-67cb-4940-845c-034fb45e816an%40googlegroups.com?utm_medium=email&utm_source=footer> > . > -- 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/CAHrL7wHOD-eB%3D7A5C%3DtWW-wAPemBhXB09xQdocUwb87N1uveLQ%40mail.gmail.com.