6 ms·
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 wa
by zohebv 15y ago
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++.
- cageface 15y agoIt 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.
- stephen_g 15y agoYep, 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!
- dzorz 15y agoEven better: for (auto &x : vec) { }
- cageface 15y agoI can't wait until I can start using this in XCode.
- dzorz 15y agoIf you compile recent clang, it supports range based for loops. Using https://github.com/Rip-Rip/clang_complete 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).
- voyvf 15y ago> 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
- cageface 15y agoI'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.
- masklinn 15y agoIt is also slower than most alternatives, and is in the same (real) memory ballpark as Java. On the other hand, it does compile fast.
- azth 15y agoKeep in mind that the current Go compilers are not mature yet, and don't do any significant optimizations. The GC is pretty primitive too.
- masklinn 15y agoI 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)
- ianlancetaylor 15y ago"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.
- LiveTheDream 15y agoWould 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.
- uriel 15y agoThe Go distribution already contains plenty of idiomatic, well written and very readable code.
- coliveira 15y agoIt would be interesting if you did the necessary optimization and posted your results for a better comparison.
- supersillyus 15y agoIt'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.
- igouy 15y agoPlease show that including comments, license, whitespace ... made some kind of significant difference to the comparison. http://news.ycombinator.com/item?id=2618625 http://news.ycombinator.com/item?id=2618625