Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

One of the interesting details is that Go Pro required 786 lines of code as opposed to 850 lines of C++ code and 297 lines of Scala Pro code. Regular Go code was 902 lines. It certainly doesn't look like Go scores any expressiveness points over C++.


"Go Pro" is unfortunately a very misleading name. I just spent an hour cleaning up his use of Go. Nobody made any attempt to actually turn this code into a well-written Go program. I did not realize that he was going to publish it externally.


Would you consider touching up the Go version again to make it more idiomatic and well written? I'd be interested in seeing good Go examples; I'm sure many others here would as well.


The Go distribution already contains plenty of idiomatic, well written and very readable code.


It would be interesting if you did the necessary optimization and posted your results for a better comparison.


It is also slower than most alternatives, and is in the same (real) memory ballpark as Java.

On the other hand, it does compile fast.


Keep in mind that the current Go compilers are not mature yet, and don't do any significant optimizations. The GC is pretty primitive too.


I keep that in mind. As well as it getting slower as it starts doing useful work and optimizations, thus losing its "fast compilation" edge (which is just about its only advantage right now)


It's also interesting to note that it looks like he measured LOC with "wc -l", so all includes, comments (including license), whitespace, debug code, and the main are included. LOC isn't a great metric, and the authors of this paper seem to make it worse by not measuring it very well.


Please show that including comments, license, whitespace ... made some kind of significant difference to the comparison.

http://news.ycombinator.com/item?id=2618625


It may just be because I've been writing a ton of C++ lately, but to me the C++ data declarations are the most readable of the bunch. The stuff with iterators is much uglier, of course, but so far I like the syntax of C++ a lot better than that of Go.


Yep, iterators are one of the most annoying things in C++. That's why I love range for in C++0x - instead of writing this, for example:

for(std::vector<std::string>::iterator it = vec.begin(); it != vec.end(); it++)

you can just do:

for(std::string x : vec)

So awesome!


Even better:

for (auto &x : vec) { }


I can't wait until I can start using this in XCode.


If you compile recent clang, it supports range based for loops.

Using https://github.com/Rip-Rip/clang_complete you can use smart context-aware completion with vim/emacs.

For example if you had this code:

vector<string> vec; for (auto &x : vec) { x

and then if you typed period (.), it would show members from std::string. I'd say it works better than Intellisense (it's very precise and you use the same parser for code completion and final compilation).


I'm too dependent on the rest of the integration with XCode to venture back into emacs land again but I'm looking forward to a rev of XCode that includes this.


> If you compile recent clang, it supports range based for loops.

Thanks for the tip, will update my copy and try it out this weekend! :D




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: