News for hackers. Stuff that matters.
Re:Golang: How to Update APIs for Generics by rawoke083600 on Thursday September 16, 2021 @04:27AM (#28549357)
THIS ! and "pattern-matching" :)
Re:Golang: How to Update APIs for Generics by a-saleh on Thursday September 16, 2021 @05:13AM (#28549583)
So, in the end all of languages move closer to StandardML :D Like even python has sum-types and pattern matching now!
Re:Golang: How to Update APIs for Generics by rawoke083600 on Thursday September 16, 2021 @06:03AM (#28549835)
Lol I know I know... but it is so useful :)
Re:Golang: How to Update APIs for Generics by xmorse on Thursday September 16, 2021 @05:38AM (#28549701)
That would be awesome!
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.