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

Did the author even learn Go?

Gofmt is for consistency for all devs to be on the same page, the format and structure is part of the language.

Are they complaining about the inheritance and generics, again did they learn Go? Stop thinking in about other languages when you are writing Go code, think the Go way.



What is the Go way to implement a generic data structure that can't be trivially realised by wrapping a couple maps and arrays into a struct (without using interface{} and throwing away the safety Go's type system, such as it is, provides)?


You first reconsider your need to make a generic data structure and evaluate on a case by case basis.


Mhm, sure, I can go back a couple decades for the sake of argument.

Say I can make do with instances of my data structure for, I don't know, int8, int16, and strings.


That's a glib answer. You end up with a bunch of duplicated code when you do this.


How often do you implement generic data structures in your code? The last time you wrote one was probably in your data structures class.


There are many, many, many "legitimate" "real-world" situations where you need data structures ouside of the two or three Go gives you by default. Queues? Dequeues? Trees, for the love of $DEITY? Tries? Sets?

Effective use of Golang is really teaching yourself to think that anything beyond the language is a useless distraction or some kind of academic pretension. I won't go so far as to call it S________ S_______, but this is textbook Blub.


I needed a ListMultimap a couple of weeks ago. Fortunately it had already been implemented for me because my language doesn't prevent that.


The last time I wrote one was a few weeks ago. I've written dozens of them during my career.




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

Search: