Earlier quoted context omitted.
Go programs don't just use less memory, the language makes it possible to control memory allocations. With the JVM-based languages I'm familiar with, it is difficult to control the memory allocation characteristics of you program, and typically the further the language deviates from the JVM's model (eg, Clojure and Scala) the more garbage must be generated (usually in doing= things like runtime type reflection). All…
I don't see anything special in Go for commanding the GC, can you point me to these APIs?
Why I Program in Go
41–50 of 171 posts
Re: Why I Program in Go
#42Earlier quoted context omitted.
The only reason you hear less "crazy" Go GC stories is because Go has never been tested as much as the JVM under different application requirements. And if high-profile companies have servers that spend 80% of the time in GC -- well, they must have really neglected their code. That's a result of poor software maintenance, and I doubt any language could help them.
No... It's because Java totally sucks when objects go from Eden to Survivor and then needs to be GC'ed or from Eden to Survivor to Tenured and then needs to be GC'ed. That's the very reason why some trading companies who still insist on using Java do use methods where as few objects as possible are ever created and went on to invent things like the LMAX disruptor "pattern" (more like an anti-pattern, where the goal i…
And, BTW, if you think Go has some magic GC secrets that will make all (or even some) of the JVM GC problems go away -- I believe you're mistaken.
Re: Why I Program in Go
#43His second point is, to me, the most important for would-be language designers: Standardized formatting: A standard tool to enforce formatting rules that is not subject to change based on the team members' or leader's opinions is a welcome feature for lowering the "not my code" mental barrier. This is a godsend. The best thing to have happened to our industry since a very long time. But his first point is oversimplif…
Seeing more total languages used in industry would be pretty cool.
Re: Why I Program in Go
#44Earlier quoted context omitted.
I don't see anything special in Go for commanding the GC, can you point me to these APIs?
Go's memory model has similarities to C. For instance you can use the heap or the stack. Go figures out which one an allocation should live in by doing escape analysis. If it never leaves the function it goes on the stack. If it does it goes on the heap. GC ensures anything on the heap gets cleaned up. It's not an API.
Re: Why I Program in Go
#45His second point is, to me, the most important for would-be language designers: Standardized formatting: A standard tool to enforce formatting rules that is not subject to change based on the team members' or leader's opinions is a welcome feature for lowering the "not my code" mental barrier. This is a godsend. The best thing to have happened to our industry since a very long time. But his first point is oversimplif…
> The compiler not only checks for code that can theoretically result in a [logically correct], runnable program...
Some examples of this:
- If you try to assign to a variable that will never be read, this is a compile-time error.
- If you try to import a module that will never be used, this is a compile-time error.
- If your dependencies don't form a DAG, this is a compile-time error.
Incidentally, not only does this make runtime errors (or logical errors) much less common, it also makes Go code more readable and vastly contributes to its impressive compilation speed.
Re: Why I Program in Go
#46Re: Why I Program in Go
#47Earlier quoted context omitted.
Even if that's the case, Go just brings too little to the table. And if you think gofmt is cool, take a look at Project Jackpot [1], or its use in the NetBeans IDE [2]. [1] https://bitbucket.org/jlahoda/jackpot30/wiki/Home [2] http://netbeans.org/kb/docs/java/editor-inspect-transform.ht...
Those aren't in the stdlib. gofmt is. So is gofix, go vet, godoc and a host of other things. Batteries included means a lot.
Which also means that you can count on any Go code you find online to be formatted the same way too.
It's like PEP 8, except better, because it's a lot more widely enforced.
Re: Why I Program in Go
#48Earlier quoted context omitted.
I don't see anything special in Go for commanding the GC, can you point me to these APIs?
Go's memory model has similarities to C. For instance you can use the heap or the stack. Go figures out which one an allocation should live in by doing escape analysis. If it never leaves the function it goes on the stack. If it does it goes on the heap. GC ensures anything on the heap gets cleaned up. It's not an API.
In fact, in certain cases the JVM can detect type information and remove the allocation entirely by hoisting integer fields and the like into registers.
Re: Why I Program in Go
#49Earlier quoted context omitted.
The only reason you hear less "crazy" Go GC stories is because Go has never been tested as much as the JVM under different application requirements. And if high-profile companies have servers that spend 80% of the time in GC -- well, they must have really neglected their code. That's a result of poor software maintenance, and I doubt any language could help them.
No... It's because Java totally sucks when objects go from Eden to Survivor and then needs to be GC'ed or from Eden to Survivor to Tenured and then needs to be GC'ed. That's the very reason why some trading companies who still insist on using Java do use methods where as few objects as possible are ever created and went on to invent things like the LMAX disruptor "pattern" (more like an anti-pattern, where the goal i…
Re: Why I Program in Go
#50Earlier quoted context omitted.
Oh, I don't doubt many things can be done much better in other languages than Java, only why stop at Go? Clojure pretty much hits every single one of your requirements, it's more modern and expressive than Go, gets concurrency better, and it's about as slower than Go as Go is slower than Java -- and getting faster. Also, you don't have to give up the monitoring and instrumentation the JVM gives you, as well as the va…
> I'm not so sure about that. If I'm not mistaken, most Go objects are mutable and can still be passed as messages. This is actually a complex subject. Go has mutable objects yes. But it also doesn't treat everything like an reference type. You have to send a pointer as the message if you want the receiver to be able to modify the object you sent. (slices and maps are the exception to this) I actually don't think imm…