This is much better than the previous Go documentation, particularly in the concurrency area. The previous Go documentation introduced goroutines and channels, stated the mantra "share by communicating, not by sharing", and then gave examples with variables shared between goroutines. It now seems to be recognized that, in Go, if you want to lock shared data, use the lock primitives. Don't try to construct locking pri…
You've been misinformed. The 2009 version of Effective Go stated, as it does now: "This approach can be taken too far. Reference counts may be best done by putting a mutex around an integer variable, for instance." https://web.archive.org/web/20091113154825/http://golang.org...
First chapter of Kernighan and Donovan's new Go book [pdf]
161–170 of 233 posts
Re: First chapter of Kernighan and Donovan's new Go book [pdf]
#162From the book: "But it has comparatively few features and is unlikely to add more. For instance, it has no implicit numeric conversions, no constructors or destructors, no operator overloading, no default parameter values, no inheritance, no generics, no exceptions, no macros, no function annotations, and no thread-local storage."
compare this with python, which has carefully evolved into a better language.
Re: First chapter of Kernighan and Donovan's new Go book [pdf]
#163Earlier quoted context omitted.
> What is Go well suited for other than network programming? Why might one decide to write the backend API of their web app in Go, compared to say Grails, Python etc. You'll get a lot of different opinions on this. I'll just speak based on my experience, since Python was my primary language before coming to Go. Everything I used to use Python for, I can do faster in Go. The notable exception to this is statistical an…
100x? Even 10x is very significant. Why is it that you feel so much more productive in Go? Is it ease of refactoring? Lack of frustrating bindings bugs? Something else?
Re: First chapter of Kernighan and Donovan's new Go book [pdf]
#164Earlier quoted context omitted.
No, the authors specifically said that they would like to have generic features but couldn't figure out a way to implement it without unacceptable performance problems. I'm pretty sure the feature will show up in the next few minor version increments.
> I'm pretty sure the feature will show up in the next few minor version increments. No it won't. People need to stop expecting generics because it will never happen. Not that agree with this but it was made pretty clear in the go-nuts mailing list that the Go team wants to keep Go type system "simple".
Re: First chapter of Kernighan and Donovan's new Go book [pdf]
#165Would Go provide a viable alternative to C++ for numeric and computer graphics 'kind of stuff'? I have no problem with C++ but the better-than-python proclamations got me intrigued.
Re: First chapter of Kernighan and Donovan's new Go book [pdf]
#166Earlier quoted context omitted.
> Hard tabs make "pretty/readable indent" formatting difficult too. That's alignment not indentation. AFAIK gofmt uses spaces for vertical alignment
But, that's arguing two points, right? That's like saying ASCII has 8 built in non-visual field separators, so people should use those instead of CSV/TSV for text tables. Sure, it's technically the right distinction, but it's not practical in any reality in which we live. Trying to say "alignment" is distinct from "indent" and that tabs and spaces can be mixed depending on your intention is just crazy talk. The only…
Re: First chapter of Kernighan and Donovan's new Go book [pdf]
#167Earlier quoted context omitted.
While Go does provide channels, I'd argue that they are not dead simple. I'm not saying this to bash Go, and I have willingly used it to solve problems. But I think it needs to be made more clear that this often-praised aspect of Go may disappoint those who are familiar with alternative techniques available in mainstream (read: not Haskell) languages. For instance, look at the "Go Concurrency Patterns: Pipelines and…
>This article goes into more detail on the weaknesses of pipelining in Go: https://gist.github.com/kachayev/21e7fe149bc5ae0bd878 This write-up provides some great arguments for why generics could be very useful for abstracting away some of the details of concurrency management. I find it odd how so many Go developers insist generics are totally unnecessary.
Myself, I think enforced tab-based formatting is utterly insane, but ultimately it doesn't matter. Part of the philosophy behind Go is to keep certain things very simple, and leaving generics out is a big part of that. I don't think that they're going to change their mind because non-Go programmers advocate for them. If that makes it the wrong language for your project, then there are so many others to consider.
Re: First chapter of Kernighan and Donovan's new Go book [pdf]
#168Earlier quoted context omitted.
Which is why Go is advocating using "go generate" to generate code. See projects such as https://clipperhouse.github.io/gen/
A fantastic idea, even slower to compile (since you need to parse extra source files), more complex workflow, and extra files which developers have to remember to ignore.
Re: First chapter of Kernighan and Donovan's new Go book [pdf]
#169Earlier quoted context omitted.
Go is very contrarian, and I applaud this. It takes more than reversing the order of parameters and using known-braindead ideas like codified tabs-are-good syntax to make contrarian ideas valuable. Just because you change green lights to mean stop and red lights to mean continue doesn't make contrarian suddenly better than the way things were.
While I think your comment is unconstructive, I do have to say that I don't quite understand why Go decided to force hard tabs. Even more confusingly to me, I really don't understand why they seem to standardize on tabs expanding to 8 spaces rather than 4. The 2 spaces (of soft or hard tabs) favored by some Ruby and CoffeeScript programmers is too little, but 8 spaces is way too much.
Re: First chapter of Kernighan and Donovan's new Go book [pdf]
#170Earlier quoted context omitted.
> I find that to be a very odd statement. Usually, the developer waits for the compiler in order to find out if the code compiles and executes properly. That is, every minute of compiler time costs a minute of developer time. If your business starts to hit a wall on compile times you can buy a computer that can compile twice as fast. It's much harder to buy a developer who can think twice as fast. And every year the…
It depends on the use case... C# is a wonderful language, since the addition of generics and lambdas, it's downright beautiful to work with. But this does come with a cost... Even a simple hello world console app has a pretty significant spin up time compared to go, or anything that is truly compiled. In some cases, if you have long-lived services, then Java and .Net make sense... You can get farther with the code in…
And I doubt generics make a significant difference in runtime but I don't have a CLR v1.1 around to test it out. For comparison, a C# hello world takes about 10ms longer than a C one (both compiled with optimizations; .NET 4.6 C# 6 / MSVC 19) on my i5 Broadwell laptop. Timing as measured by "time" in bash (~25ms vs ~35ms).
I'm guessing you're talking about JIT in general and of course have a point there. I doubt it's significant for any significant values of significant.