Earlier quoted context omitted.
Are there any plans to add generics yet, or do I still have to write a bunch of extra boilerplate functions in order to sort a list?
That's something for the Go creators to decide, but personally I enjoy the feeling of safety that comes with lack of generics. I have very few Go bugs at runtime and I think that explicitness plays a huge part in it.
Go by Example
11–20 of 130 posts
Re: Go by Example
#12This documentation is great, but one thing I tend to miss with examples like these is how to structure a project, deal with packages, etc.
Re: Go by Example
#13Earlier quoted context omitted.
Are there any plans to add generics yet, or do I still have to write a bunch of extra boilerplate functions in order to sort a list?
That's something for the Go creators to decide, but personally I enjoy the feeling of safety that comes with lack of generics. I have very few Go bugs at runtime and I think that explicitness plays a huge part in it.
func (a ByAge) Len() int { return len(a) }
func (a ByAge) Swap(i, j int) { a[i], a[j] = a[j], a[i] }
func (a ByAge) Less(i, j int) bool { return a[i].Age
How does forcing me to type out (or copy-paste) an implementation of Swap increase safety? If anything, it just makes the code more error-prone.And not having generics means that (as far as I can tell) people end up using a lot of `interface{}`. How does that increase safety?
More importantly, why would I want to use a language whose solution to the problem of "dealing with generic data" essentially boils down to "use a void*"?
Re: Go by Example
#14It's Friday gents! No excuse to set aside Saturday and Sunday, you can easily go through these examples in two days and grok it. Go is that _slim_, and that's good! Guaranteed you'll find use for Go in one system or the other when you want easy deployment, fast development time and extreme speeds. :) (Disclaimer: I love Go and I hope it goes mainstream in a big way in 5 years)
Are there any plans to add generics yet, or do I still have to write a bunch of extra boilerplate functions in order to sort a list?
Re: Go by Example
#15The documentation format is a revolution of simplicity and comprehension. I can see this list format (and content) working for any/all languages.
[1]: http://fitzgen.github.io/pocco/ [2]: http://jashkenas.github.io/docco/
Re: Go by Example
#16Earlier quoted context omitted.
Are there any plans to add generics yet, or do I still have to write a bunch of extra boilerplate functions in order to sort a list?
What does yet another gripe about generics in Go have to do with a tutorial written by an independent party, one that is about features in the language today ?
> Go is that _slim_, and that's good! Guaranteed you'll find use for Go in one system or the other...
I'm all for learning new programming languages, but if you're going to learn a new programming language, why not use one that has new ideas?
Re: Go by Example
#17Re: Go by Example
#18This documentation is great, but one thing I tend to miss with examples like these is how to structure a project, deal with packages, etc.
GitHub is your friend here. Here is a search for Go repositories with > 100 stars.[1] Every project will look different (the really big ones might be more complex then you need) but as you get deeper into the results you can find some great stuff. [1]: https://github.com/search?l=go&q=stars%3A%3E100&s=stars&type...
Re: Go by Example
#19Re: Go by Example
#20Earlier quoted context omitted.
What does yet another gripe about generics in Go have to do with a tutorial written by an independent party, one that is about features in the language today ?
It was in response mainly to: > Go is that _slim_, and that's good! Guaranteed you'll find use for Go in one system or the other... I'm all for learning new programming languages, but if you're going to learn a new programming language, why not use one that has new ideas?
My point is that generics are not a new idea either, and plenty of languages offer them. Go is not meant (anymore) to replace C/C++/Java or even Rust. It will never have all the features of those, and probably should not.
But it seems impossible to have a HN discussion on Golang without part of the thread getting hijacked with "But generics!!!" This make no more sense to me than considering other languages incomplete because they don't generate static binaries.