7 ms·
Nice read. I like Go a lot too. As to the minimalism in Go, I wish it came with a few more default data containers. Sorting a map by using a slice gets old af
by w8rbt 9y ago
Nice read. I like Go a lot too.
As to the minimalism in Go, I wish it came with a few more default data containers.
Sorting a map by using a slice gets old after awhile. Why can't I pick a sorted tree based map (like std::map or std:set in C++) or an un-ordered hash based map like std::unordered_set, etc.? Why do the containers have to be so minimal too?
This just leads to people rolling their own and many times, that leads to poor performance and other issues which ultimately reflect poorly on the lanaguage. I've seen more string implementations in C than I can count. Most of them were bad. I hope Go doesn't end-up being like that.
- oconnor663 9y agoI also wish the default containers supported some more magical functions or methods, like `reverse` for lists and `union` for maps/sets.
- timtadh 9y agoI too wish there was more standard containers available in Go's standard library. However, I don't think there will be a collections package unless and until generics make it into the language. That said, there are some pretty good libraries out there: - https://github.com/timtadh/data-structures https://github.com/timtadh/data-structures ## I wrote this one. - https://github.com/Workiva/go-datastructures https://github.com/Workiva/go-datastructures ## this one is also popular. - https://github.com/golang/go/wiki/Projects#data-structures https://github.com/golang/go/wiki/Projects#data-structures ## big list here.
- w8rbt 9y agoThank you for the links. I hope Go gets a good, solid container library that is reputable and widely used. And even better if that makes into Go proper some day.
- logicallee 9y ago>This just leads to people rolling their own [containers] Nah, Go was careful to make that impossible. (You know exactly what I'm talking about, I'm not going to come out and say it. What one, specific thing makes rolling your own container in Go literally impossible?)
- Waterluvian 9y agoClasses (inheritance)? (I'm actually guessing... This isn't my domain)
- dmoy 9y agoI'm guessing they meant generics? Also not sure.
- logicallee 9y agoYes, that is what makes it literally impossible to roll your own container.
- kasey_junk 9y agoThey meant generics. But it’s not impossible, it’s tedious.
- paulddraper 9y agoGenerics. You can't write good containers without generics. And it's the #1, #2, and #3 Go issue that people complain about. (Unless of course you do code generation...but then you're not writing Go, you're writing a program that writes in Go.)
- logicallee 9y agoyes. no idea why I'm being downvoted so heavily. you can't write your own containers today.
- gitgud 9y agoIs it concurrency issues, race conditions?
- deleted 9y ago[deleted]
- 9y ago
- WalterBright 9y ago> I've seen more string implementations in C than I can count. Most of them were bad. I've written them over and over, myself. They're all bad, because the problems are nigh insurmountable: 1. C string literals don't know or care about your string package. 2. Once you step outside of the string package, you're incompatible with everything else. 3. C determinedly and resolutely devolves arrays into pointers. https://digitalmars.com/articles/b44.html https://digitalmars.com/articles/b44.html