Live data from Hacker News

Go by Example

gobyexample.com

31–40 of 130 posts

Re: Go by Example

#31

It'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)

One nice thing these examples also do is make it really simple for detractors to point out what they don't like about it. My #1 gripe about go, for example, is this: https://gobyexample.com/sorting-by-functions In a few other languages: // C++ sort(vs.begin(), vs.end(), [](const string& l, const string& r) -> bool { return l.size() When they fix this, Go might be the perfect language for me. Until then, I'm not touch…

With C++14 this becomes

    sort(begin(vs), end(vs),
         [](auto const& l, auto const& r) { 
             return l.size() 
Even simpler.

Re: Go by Example

#32

It'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?

http://commandcenter.blogspot.co.uk/2011/12/esmereldas-imagi...

Re: Go by Example

#33

It'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)

One nice thing these examples also do is make it really simple for detractors to point out what they don't like about it. My #1 gripe about go, for example, is this: https://gobyexample.com/sorting-by-functions In a few other languages: // C++ sort(vs.begin(), vs.end(), [](const string& l, const string& r) -> bool { return l.size() When they fix this, Go might be the perfect language for me. Until then, I'm not touch…

A few extra lines for sorting means you won't touch Go with a pole? That's a bit extreme. Do you really do custom sorting so often that this is a major problem?

There's plenty of other ways in which Go is shorter than the equivalent C++ (e.g. with type inference, or channel operations), but no-one's trying to claim that the shortest code wins.

Re: Go by Example

#34

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?

http://commandcenter.blogspot.co.uk/2011/12/esmereldas-imagi...

"I resolve to recognize that a complaint reveals more about the complainer than the complained-about. Authority is won not by rants but by experience and insight, which require practice and imagination. And maybe some programming."

Of course, being Rob Pike, decreeing that authority and experience is more valuable than any (well-reasoned) complaints from other people is a very convenient stance for him to take; how many complainers are going to rival his résumé?

Re: Go by Example

#35
post #28
post #25

Earlier quoted context omitted.

Go generics and Mongo durability in the same thread. There is a trifecta brewing here...

Never underestimate the power of nitpicking in an HN thread.

It is amusing that you consider either generics or durability to be "nitpicks." One is a feature that is present in almost every static language of at least the last two decades, and another is a fundamental need of most database users, relational or not. Unless by nitpick you mean, "something I personally don't care about," I think your nitpick-classifier is a bit busted.

Re: Go by Example

#36
post #14

Earlier 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?

Because it's much faster than other languages at its difficulty level. Which can save a lot of money.

Re: Go by Example

#37

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.

Not having generics reduces explicitness (because you don't specify the types of your containers) and reduces safety (because of all the casts and manual implementations of things like swap functions).

Re: Go by Example

#38

It'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?

Complaint("write a bunch of extra boilerplate functions in order to sort a list");

Re: Go by Example

#39

It'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)

One nice thing these examples also do is make it really simple for detractors to point out what they don't like about it. My #1 gripe about go, for example, is this: https://gobyexample.com/sorting-by-functions In a few other languages: // C++ sort(vs.begin(), vs.end(), [](const string& l, const string& r) -> bool { return l.size() When they fix this, Go might be the perfect language for me. Until then, I'm not touch…

Wow, yeah. This is pretty bad. The example doesn't even make logical sense. Why is ByLength a type? Shouldn't you just want to pass in an array?

Can any "idiomatic" Go programmers here give a better example of how you would do this?

Re: Go by Example

#40

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?

http://commandcenter.blogspot.co.uk/2011/12/esmereldas-imagi...

[deleted]
Post reply on HN