News for hackers. Stuff that matters.
Re:Microsoft takes .NET open source and cross-platform by useerup on Wednesday November 12, 2014 @03:52PM (#8598064)
async/await is HUGE.

It opens an almost frictionless asynchronous pathway from your code all the way down to asynchronous capabilities of the underlying platform. Which was always the problem with leveraging async/overlapped IO: It was too complex and it turned your application logic inside-out because everything had to be performed in callbacks. async/await takes that on directly: You get everything executed in callbacks - only the callbacks are transparently created for you along with the necessary finite state machines so that your code still composes with exceptions, loops, branches working the way you expect - even across those "invisible" callbacks.

For server scalability as well as responsiveness on small devices (keeping number of thread low - even at one - while still serving the UI), that is really an advantage.

There is no "fakes" on the way - no extra threads being started just to wait for completion of an otherwise synchronous API. If the platform supports asynchronous IO/network/disk/database you can leverage that without any of the strange complexities of other languages.

Worth mentioning here is that Windows has an easier scalable and better designed completion oriented async model compared to the readiness oriented model of Linux - which is mostly limited to sockets anyway.

OS X has GCD - which is also a completion oriented model. I look forward to seeing how .NET with real global optimizing compilers from MS will do on OS X versus Linux versos Windows (on a Mac, obviously).

Re:Microsoft takes .NET open source and cross-platform by orf on Wednesday November 12, 2014 @07:14PM (#8599183)
FYI Python has had an await equivalent for a looong time through the Twisted networking library and now asyncio. It has the same semantics, but you use the yield keyword instead of await.

Also as of recently there is a standard library event loop package, and as far as I know Twisted was the defacto event loop on 2.x for most types of work.

Re:Microsoft takes .NET open source and cross-platform by pjmlp on Thursday November 13, 2014 @01:51AM (#8600278)
Having used Python during my time at CERN, I would never use it for anything besides scripting tasks. Maybe when PyPy reaches feature parity with mainline Python.
Re:Microsoft takes .NET open source and cross-platform by vishnugupta on Thursday November 13, 2014 @01:46AM (#8600256)
Could you please contrast async/await implementation with Future in Java?

From the usability standpoint I see that they are more or less similar. However since you state that async/await exploits the asynchronous capabilities of the underlying platform I'm really curious to know how is this different from the way the way Future is implemented in a JVM.

Re:Microsoft takes .NET open source and cross-platform by pjmlp on Thursday November 13, 2014 @02:23AM (#8600346)
Futures in .NET are tasks and the Fork/Join framework is TPL (Task Parallel Library).

Async/await allows developers to write code that looks sequential, but is rewritten by the compiler into a sequence of coroutines built on top of TPL, while taking care error propagation happens correctly.

Re:Microsoft takes .NET open source and cross-platform by recursive on Wednesday November 12, 2014 @06:15PM (#8598925)
FYI emcrazyone, it appears that you have been shadow-banned. I don't have any specific recommendations for your question, but I thought you should know.
Re:Microsoft takes .NET open source and cross-platform by Cthulhu_ on Thursday November 13, 2014 @03:51AM (#8600549)
Telling people they have been shadow-banned defeats the purpose of it.
Re:Microsoft takes .NET open source and cross-platform by recursive on Thursday November 13, 2014 @12:36PM (#8602774)
In that case, it's a purpose that I don't support.
Re:Microsoft takes .NET open source and cross-platform by jabbernotty on Thursday November 13, 2014 @05:44AM (#8600842)
It does not serve a purpose to me. To whom does it serve a purpose to shadow-ban that user, and what purpose is it?
Re:Microsoft takes .NET open source and cross-platform by Rapzid on Thursday November 13, 2014 @01:45AM (#8600252)
Tasks are pretty awesome and just about as convenient as Go-routines. Now if we could just get typed channels in .Net >:]
Re:Microsoft takes .NET open source and cross-platform by Matthias247 on Thursday November 13, 2014 @07:43AM (#8601212)
How about BlockingCollection<T>? If I understand it correctly you can even have select like sementics with BlockingCollection.TakeFromAny(...)

Edit: Sorry, messed it up a little bit. BlockingCollection will block your current thread for any other computation and does not allow to await on it.

But there seem to be alternatives: http://stackoverflow.com/questions/21225361/is-there-anythin... http://blog.stephencleary.com/2012/12/async-producer-consume...

Re:Microsoft takes .NET open source and cross-platform by tracker1 on Thursday November 13, 2014 @03:08AM (#8600442)
I don't think it would be very hard at all to create a generic CSP system with C# (or F# for that matter). I've built similar systems using WCF.
Re:Microsoft takes .NET open source and cross-platform by Paradigma11 on Thursday November 13, 2014 @07:23AM (#8601144)
Doesn't rx fill that role?
Re:Microsoft takes .NET open source and cross-platform by Matthias247 on Thursday November 13, 2014 @07:57AM (#8601262)
With Rx you can do similar things but the semantics are different. When you use an Rx Stream you will get the data pushed from a different thread. With Go-like channels you pull the data from the other thread (or the channel).