News for hackers. Stuff that matters.
Re:Porting dl.google.com from C++ to Go by test-it on Saturday July 27, 2013 @01:53PM (#6113751)
Have you by any chance seen the async keyword in C# 5.0? It allows one to write event-based code without callbacks obscuring the control flow. From what I've heard Python is in the process of copying this feature. Iced Coffescrip does something similar also.
Re:Porting dl.google.com from C++ to Go by bradfitz on Saturday July 27, 2013 @02:05PM (#6113795)
This answer sums up my feelings best:

http://stackoverflow.com/questions/7479276/what-is-the-main-...

It's good for C#, but still a language wart that could be built-in. I like that Go only has one set of APIs for everything, not the sync way and the async way.

It's sad that C#, which started out as a fixed-up Java, is now growing its own warts.

Of course, Go's not perfect either.

Re:Porting dl.google.com from C++ to Go by dragonwriter on Monday July 29, 2013 @02:43PM (#6123001)
> I haven't yet tried Go, but I don't see how it could match the performance of C# API with a single function. C#'s async methods offload any IO to the process IO completion port threads, thus freeing the current thread to do more work.

Go generally uses synchronous functions, but a function in Go can be the subject of a "go" statement (sharing the name of the language should give an importance of how central this feature is), which causes the function to be executed as a goroutine (that is, asynchronously using an M:N threading model.)

Re:Porting dl.google.com from C++ to Go by wolf550e on Wednesday July 31, 2013 @12:09PM (#6134759)
You meant to reply to test-it, but instead it looks like you're teaching a member of the Go team how Go works.
Re:Porting dl.google.com from C++ to Go by test-it on Monday July 29, 2013 @02:36PM (#6122955)
Very interesting.

I haven't yet tried Go, but I don't see how it could match the performance of C# API with a single function. C#'s async methods offload any IO to the process IO completion port threads, thus freeing the current thread to do more work.

Re:Porting dl.google.com from C++ to Go by STRML on Sunday July 28, 2013 @01:54AM (#6115766)
Node-fibers allows a similar thing with a pretty raw syntax. At least one clever programmer has painted over it and introduced await/defer in Node without any JS pre-processing [1].

If you enjoy CoffeeScript, Iced CoffeeScript does a great job of this too.

[1] http://alexeypetrushin.github.io/synchronize/docs/index.html