News for hackers. Stuff that matters.
Re:Good-bye core types; Hello Go as we know and love it by divan on Wednesday March 26, 2025 @06:10PM (#43488017)
What data structures can't be implemented without generics?
Re:Good-bye core types; Hello Go as we know and love it by vessenes on Wednesday March 26, 2025 @07:16PM (#43488605)
I think anything could be implemented, since you’ve got byte arrays in the language, which I imagine is your point.

It’s more what you must implement along with your new data structure to make it usable in the language that was the cry of the generics advocates.

Re:Good-bye core types; Hello Go as we know and love it by bsaul on Wednesday March 26, 2025 @06:44PM (#43488325)
i guess maps and array ? ( if you wanted to reimplement your own in a typesafe way, that is)
Re:Good-bye core types; Hello Go as we know and love it by jerf on Wednesday March 26, 2025 @08:35PM (#43489156)
I don't think there's anything you "can't" implement that the language reserves for itself anymore. There may be some edge case or something but in general it's no longer an issue.

The language reserves syntax for itself; you can't overload a[b] to mean anything other than either array/slice indexing or indexing into a map. You have to write methods like ".Get" or something, there's no __getattr__ or anything.

Re:Good-bye core types; Hello Go as we know and love it by ts4z on Thursday March 27, 2025 @01:55AM (#43490729)
Go has good (enough) built-in arrays and maps. But if you want a tree, without generics, you're really limited. With generics, you can get a nice containerized type, but you don't get the nicer syntax that the builtins have.

It's not just types, either. Look at the signature for the built-in sort, which is amazingly cumbersome to use. A generic wrapper around it hides all the ugly.