News for hackers. Stuff that matters.
Re:Guido says goodbye to Google by jrockway on Friday December 07, 2012 @06:02PM (#4889709)
I personally see Go as more of a Java replacement than anything.
Re:Guido says goodbye to Google by codewright on Friday December 07, 2012 @06:10PM (#4889738)
Go complements and sorta-kinda replaces Python for web programmers.

Go replaces Java for Google and most other companies.

Go was supposed to replace C++ but didn't even come close despite the best intentions of Pike and ken.

Comical.

Re:Guido says goodbye to Google by kennu on Friday December 07, 2012 @07:35PM (#4890029)
How does Go replace Python for web development? Is there a thriving web framework and module ecosystem for Go, like Django/Rails are for Python/Ruby?
Re:Guido says goodbye to Google by dchest on Friday December 07, 2012 @07:48PM (#4890086)
Why do you need Django/Rails for web development?
Re:Guido says goodbye to Google by spamizbad on Friday December 07, 2012 @08:15PM (#4890173)
You don't. But without something like them (or microframeworks + libs) you're going to be rewriting a bunch of stuff yourself. On top of that, security sensitive parts (session management, CSRF protection) that get hand-rolled will need a significant amount of testing.

If you have the time and resources though... go for it!

Edit: But it does seem like there's already some contenders for Go's go-to framework (Like Django/Rails are for their respective language)

http://robfig.github.com/revel/

http://code.google.com/p/goweb/

https://github.com/ungerik/go-start

Re:Guido says goodbye to Google by dchest on Saturday December 08, 2012 @07:29AM (#4891476)
My point was that you don't need huge frameworks with high barrier to entry to write web applications -- the things you mentioned can be handled by external modules just as well. Need captcha? Find the best captcha package and use it.
Re:Guido says goodbye to Google by pretoriusB on Sunday December 09, 2012 @06:00AM (#4894437)
Yes, and tomorrow that captcha package is abandoned, left to rot, etc. Or some other library you used. Especially since most Go packages are one man shows in GitHub (3-4 abandoned MySQL drivers, etc).

I'd rather have a framework with a community that ensures that it is guaranteed to be maintained in the future.

Re:Guido says goodbye to Google by cmccabe on Friday December 07, 2012 @10:09PM (#4890453)
Re:Guido says goodbye to Google by DigitalJack on Friday December 07, 2012 @07:15PM (#4889965)
I am not a programmer by trade... but I'm a little confused as to why you would say Go can replace java but not c++? Is it just a speed thing?
Re:Guido says goodbye to Google by koko775 on Friday December 07, 2012 @07:40PM (#4890051)
C++ gives you an insane amount of control, is exceedingly manual, hard to use, hard to learn, and you can easily screw yourself over by using it - but it gives you so much performance that it's worth the necessary expertise.

Go tries to be safer and more automatic, like Java. While it's more organized and prescriptive than C or C++, it's less religious than Java about everything being a class. So it encourages the pragmatism and low-levelness of closer-to-the-metal languages while also abstracting out a lot of the details which get in the way of just writing systems.

Re:Guido says goodbye to Google by afhof on Saturday December 08, 2012 @03:31AM (#4891139)
I still can't grok why people pick C++. Is it just a Windows specific thing? If someone wanted speed of execution, why not use Ansi C? If someone wanted object oriented programming, why not the myriad other languages? (Java comes to mind) What does C++ do better than all the languages?
Re:Guido says goodbye to Google by azth on Saturday December 08, 2012 @10:49AM (#4891821)
> If someone wanted speed of execution, why not use Ansi C? If someone wanted object oriented programming, why not the myriad other languages?

Because they want both speed and OO programming? :)

C++ is a multi-paradigm language. It has more abstractions than C, while retaining the ability to get down to the metal when you need to. Arguably, these higher level features are desirable when working on larger code bases. C++ also has features that make it easier to write clean and correct code (such as RAII). Templates and operator overloading makes for writing expressive libraries. I remember reading and article that compared C and C++ in the context of a matrix library. The C++ code was much more concise and readable, and was easier to get right compared to C, mainly due to those two features.

Furthermore, C++ can actually be faster than C. The canonical example is the templated std::sort() vs C's quicksort(). The C++ compiler is able to inline the comparator argument to the former, whereas qsort() takes a function pointer.

Re:Guido says goodbye to Google by koko775 on Saturday December 08, 2012 @04:38AM (#4891249)
While I don't have personal experience with it myself, things like games lend themselves well to a limited use of OOP but also require performance-critical code and tight control over the language. With static analysis tools, I bet that C++ could be audited more comprehensive through automated tests than C could be.
Re:Guido says goodbye to Google by myko on Friday December 07, 2012 @08:10PM (#4890153)
So the answer to the question is that C++ is just much more performant than Go in general?
Re:Guido says goodbye to Google by codewright on Friday December 07, 2012 @08:30PM (#4890213)
It's principally about control, performance is a side effect related to control and abstractions.
Re:Guido says goodbye to Google by zurn on Saturday December 08, 2012 @05:10AM (#4891293)
Rob Pike wrote a post about the curious phenomena of most Go coming from high-level languages and not from C++:

http://commandcenter.blogspot.fi/2012/06/less-is-exponential...

Apparently the remaining C++ users are really fixated on something called zero cost abstractions, and it's not a goal of Go: "Zero cost isn't a goal, at least not zero CPU cost. Go's claim is that minimizing programmer effort is a more important consideration."

(though I don't think C++ succeeds in "zero cost abstractions")

Re:Guido says goodbye to Google by pjmlp on Saturday December 08, 2012 @02:55AM (#4891089)
Go will replace Java when it will offer generics, same GC execution speed and the amount of libraries Java currently enjoys.

Channels and Goroutines are easily available in java.util.concurrent.

If you really want compilation to pure native code, there native code compilers for Java as well.

Re:Guido says goodbye to Google by _ak on Saturday December 08, 2012 @03:33AM (#4891142)
> Channels and Goroutines are easily available in java.util.concurrent.

HAHAHAHAHAHAHAHAHAHA. No.

Re:Guido says goodbye to Google by pjmlp on Saturday December 08, 2012 @03:59AM (#4891194)
With your childish comment you just showed how much you know about programming, zero!
Re:Guido says goodbye to Google by _ak on Saturday December 08, 2012 @05:26AM (#4891316)
Yeah, right. Just take a closer look what goroutines really are (hint: not threads), and how Java threads differ from them.
Re:Guido says goodbye to Google by nickik on Saturday December 08, 2012 @06:04AM (#4891362)
You show your ignorance again. Do you think that go does not use operatingsystem threads in the background? Do you think the same abstraction could and has not been built for java? How do you think does the Erlang impmentation on Java work? How do you think that scala can start so many actors? How do you think the forkjoin framework works?
Re:Guido says goodbye to Google by _ak on Saturday December 08, 2012 @01:19PM (#4892258)
Funny how we talk about Go and Java and you suddenly come up with Scala and Erlang.
Re:Guido says goodbye to Google by nickik on Saturday December 08, 2012 @03:53PM (#4892668)
Scala runs on the JVM and I said Erlang running on Java (granted I meant JVM). I was refering to this: https://github.com/trifork/erjang
Re:Guido says goodbye to Google by pjmlp on Saturday December 08, 2012 @01:37PM (#4892312)
Goroutines are what is known as green threads in Java land.

The Java specification allows for green threads, N:1 mapping of threads, or system threads, 1:1 mapping to system threads.

It is up to the Java VM or compiler to offer one implementation or even both.

Tasks in java.util.concurrent make use of thread pooling to also achieve N:1 mapping of tasks to threads.

The Squawk and the Cacao VMs are two examples of a Java VM using green threads,

http://labs.oracle.com/projects/squawk/

http://www.cacaojvm.org/

Re:Guido says goodbye to Google by pretoriusB on Saturday December 08, 2012 @06:12AM (#4891376)
Well, you and your "hint" are mistaken.

From the documentation:

"Goroutines are multiplexed onto multiple OS threads so if one should block, such as while waiting for I/O, others continue to run".

Same thing as in Java, just integrated into the language instead of a library. But then again, Scala offers that too.

Re:Guido says goodbye to Google by _ak on Saturday December 08, 2012 @01:17PM (#4892249)
You quote things you don't understand. n goroutines (where n is big) get multiplexed to m threads (small m, typically numbers of cores). Goroutines are cheap: each goroutine starts at a size of 4k, and creating them is a really cheap operation. Please show me a Java thread implementation with the same properties. Good luck with that.
Re:Guido says goodbye to Google by pjmlp on Saturday December 08, 2012 @02:56PM (#4892525)
Re:Guido says goodbye to Google by pretoriusB on Sunday December 09, 2012 @05:58AM (#4894432)
>n goroutines (where n is big) get multiplexed to m threads (small m, typically numbers of cores).

You had the same thing in early Java with green-treads -- it is abandoned for modern JVMs, but you can mimic it. You can have millions of Scala actors.

>Goroutines are cheap: each goroutine starts at a size of 4k, and creating them is a really cheap operation.

Yes, but handling and migrating them is a "not really cheap operation". They are mostly useful as abstractions, as for performance you don't get anything over Java (if not worse: checkout Go vs Java concurrency benchmarks).

>Please show me a Java thread implementation with the same properties. Good luck with that.

Not sure I need all that "luck" you wish me. How about Java on Solaris, which multiplexes java threads to native threads?