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

Here's the kicker: you don't actually end up copy/pasting much code.


You shouldn't be copy/pasting ANY code in a language created after 2000.


It's a slippery slope ("oh it's fine, I'm only copy/pasting N file(s)" where N slowly increases) which I don't want to go down.


Can you think of 3 specific examples and quantify the fan-out?


1. Float64Slice

2. IntSlice

3. StringSlice

http://golang.org/pkg/sort/


Ah yes, I've run into this. It's certainly not some kind of "rabbit hole." So basically, there's a few lines of boilerplate for each time you want to sort something. So this is O(1) additional typing per sorted type, which is what it would be for generics. You're trying to kill your argument with faint support?

EDIT: Granted, it is an unusual formulation, and far less convenient.


1-A. SearchFloat64s

2-A. SearchInts

3-A. SearchStrings

http://golang.org/pkg/sort/


Ho hum. Same arguments apply. Also O(1) per type, just like generics.




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

Search: