News for hackers. Stuff that matters.
Re:Golang: How to Update APIs for Generics by tonyedgecombe on Thursday September 16, 2021 @06:07AM (#28549855)
And exceptions :)
Re:Golang: How to Update APIs for Generics by szastamasta on Thursday September 16, 2021 @06:46AM (#28550094)
Please, just not exceptions.
Re:Golang: How to Update APIs for Generics by mseepgood on Thursday September 16, 2021 @07:10AM (#28550250)
Too late, Go already has exceptions since 1.0.
Re:Golang: How to Update APIs for Generics by pjmlp on Thursday September 16, 2021 @07:36AM (#28550420)
Indeeed,

    func ThrowIfError(err error) {
        if err != nil {
            panic(err)
        }
    }
    // ....
    name, err := FuncWithError()
    ThrowIfError(err)
Re:Golang: How to Update APIs for Generics by mseepgood on Thursday September 16, 2021 @07:08AM (#28550236)
Panic and recover already exist, which are semantically exceptions.