|
|
|
|
|
by mopsy
3259 days ago
|
|
Because you should stop asking for generics like in Java/C#/rust etc..
Such generic to make custom type safe container is like using a canon to kill a fly. You should ask for generic package/templated package.
It solve the problem, it's way simpler and and would only touch a small part of the spec.
More importantly, it wouldn't change the way we code in go today. With generic package you only have to define the parameter in package declaration like this: package list {Value: interface{} And use it by importing it like this: import list "container/list" {Value: int} And that's why to go team asked for use case. To use the most simple tool to fix a problem so there is less chance for other problems to appear.
If every people wanting to make custom type safe container would stop asking for full generics and instead would brought their case with a simpler solution. I'm sure it would have a chance to go in Go 2.0. |
|
Even that would, IMO, not be enough, as this seems (from what I infer the semantics to be) to make it impossible for writers of such a generic library to build on another generic library.
That can be fixed by allowing such a programmer to write:
but that, IMO, would be way too cumbersome. That package declaration would have to mention all types in all generic packages that get imported.