Hacker News new | ask | show | jobs
by zhong-j-yu 4343 days ago
That is where I disagree completely. I think the old fashioned sync/blocking/threaded style is much easier than async.

Of course, C# has great async support; but it is still a complicate thing that programmers must be very cautious about when applying.

1 comments

I don't think you've seen truly great async support, it's virtually indistinguishable from sync code.

Sync:

  let file = File.Open("foo.txt")
  let data = file.Read(8192)
  // Do some compute stuff with data
ASync:

  let! file = File.OpenAsync("foo.txt")
  let! data = file.ReadAsync(8192)  
  // Do some compute stuff with data
while the syntax can be as simple as that, there is still a difference, and the programmer still needs to be very careful. what if you accidentally forget the `"!"`?
Umm... it doesn't compile because it's the wrong type...

But yeah multithreading is easy.