News for hackers. Stuff that matters.
Re:Go 1.1 is released by minamea on Monday May 13, 2013 @06:22PM (#5701810)
This is a bad attitude, imo. The Go standard library wouldn't be possible without generics [1]. It's just that the functionality exposed to the standard library isn't exposed otherwise.

If it's a feature needed for the standard library, then it's safe to say the devs will need it to. The devs aren't (shouldn't) be consistently writing programs that are more trivial than the standard library.

[1] http://golang.org/doc/effective_go.html#append

Re:Go 1.1 is released by encoderer on Monday May 13, 2013 @06:30PM (#5701851)
Not sure I agree with this logic.

I could easily write a custom Append func in my own application because I would know the Slice types I'm trying to operate on. Writing a language feature is different than writing an application, and it has nothing to do with how trivial something is.

Honestly, Append() as a concept is about as trivial as it gets..

Re:Go 1.1 is released by gnuvince on Monday May 13, 2013 @10:07PM (#5702673)
> I could easily write a custom Append func in my own application because I would know the Slice types I'm trying to operate on.

More precisely, you would write one custom Append function per Slice type. AppendString, AppendInt, AppendWhatever.

Re:Go 1.1 is released by encoderer on Monday May 13, 2013 @10:55PM (#5702806)
Yeah, that was supposed to be singular: because I would know the Slice type I'm trying to operate on. Appreciate the clarification. I'll leave the typo there for context.
Re:Go 1.1 is released by loqi on Monday May 13, 2013 @10:36PM (#5702756)
> Writing a language feature is different than writing an application

True enough. But libraries can easily tend toward either of those extremes. And any obstacles to library development will eventually become obstacles to application development.

Re:Go 1.1 is released by frou_dh on Monday May 13, 2013 @06:42PM (#5701918)
You could also say that ANSI C has fenced off generics (array of T). Just as with Go's append and co, that's part of the language, not it's standard library.

http://golang.org/pkg/builtin/#pkg-overview

Re:Go 1.1 is released by mvzink on Monday May 13, 2013 @06:31PM (#5701857)
The thing is, you can do that with interface{} and you don't even need type switching. It's awkward, but considering that the rarity with which interface{} is necessary (at least in my experience), much less interface{} with type switching, I really don't see a big gain in generics. I agree with jff, it seems most people who complain about the lack of generics are those who haven't written much code without generics.
Re:Go 1.1 is released by TylerE on Monday May 13, 2013 @06:57PM (#5701990)
You lose a lot of type safety via interface{}. I'm currently writing a server that makes heavy use of []interface{} and I hate it. For many, most, maybe even all, code pathes in the app I could 100% static-type if Go allowed for something akin to Haskell's generies. Basically I bundle around a type `APIVal` (an alias for []interface{}), but everywhere I either take as an argument or return an APIVal, I can tell you exactly what type the underlying slice items "really" have, but I can't assert that at compile time, and it kinda bugs me.