Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

with generics you wind up with two parameter lists, and type parameters have metatypes. All type parameters need to have a metatype, and the metatype `any` comes up a lot. Once you start using generics you'll start to feel the pain of writing `interface{}` in those signatures, especially when you are dealing with functions like this one:

    func doSomething[X interface{}, Y Fooer[interface{}]](v X, src Y) error {
    }
versus:

    func doSomething[X any, Y Fooer[any]](v X, src Y) error {
    }
the signatures can get long pretty quickly when you have more than one type parameter.


Does a personal (not language-wide)

  type any = interface{}
not work, if you felt that strongly?


That's an extra line of boilerplate. If someone for some reason wants uglier and longer code then can still use interface{}




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: