News for hackers. Stuff that matters.
Re:Asynchronous IO in Rust by sillysaurus3 on Wednesday September 16, 2015 @10:17PM (#10231205)
The interface is different because if you use a green thread within a GC'd language, you can do anything -- change anything, interact with anything -- and nothing will crash. No locking involved, and no hidden locking under the hood.

It's not meant to be a performance boost, but a way of writing code where "might this crash?" is a question you're never bothered to ask. It's wonderfully freeing.

Not true of native threads. If a goroutine were replaced with a native thread, it would swiftly crash on GC.

Re:Asynchronous IO in Rust by Veedrac on Thursday September 17, 2015 @12:06AM (#10231521)
We're talking pretty explicitly about Rust, which doesn't have that problem.
Re:Asynchronous IO in Rust by wtetzner on Thursday September 17, 2015 @11:47AM (#10233988)
> a way of writing code where "might this crash?" is a question you're never bothered to ask.

Is that actually true? Yes, you won't get a partially written int, but you could still run into consistency issues if you don't lock. For example, if you need thread A to update both x and y to have a consistent state, and B is reading both x and y, A might update x, then the scheduler would switch to B, and be might read the new x and the old y. If the update A was making needed to update both x and y for the system to be in a consistent state, you have a problem.

Re:Asynchronous IO in Rust by sillysaurus3 on Thursday September 17, 2015 @01:58PM (#10234997)
It will do what you just described. And what you described won't crash.

If you use the int as an offset into raw memory, then sure, that will. But if you use it as an offset into a list, then it won't. At most it will cause an exception to be generated. That will cause the reader thread to die, because it was the code that caused the exception, but it still won't crash.

Re:Asynchronous IO in Rust by wtetzner on Friday September 18, 2015 @03:23PM (#10241492)
Right, but I don't really see how that's freeing. A crash isn't good, but having your program be incorrect might be even worse. If the program crashes, you know it. But it might take some time before you recognize that your logic is wrong, which might cause all kinds of damage.

So I don't think it frees you from thinking about concurrency at all.

Re:Asynchronous IO in Rust by theseoafs on Wednesday September 16, 2015 @11:03PM (#10231357)
This is only true for n:1 green threading.
Re:Asynchronous IO in Rust by sillysaurus3 on Wednesday September 16, 2015 @11:11PM (#10231381)
Sure. But I might write my n:1 code more quickly, robustly, and performant than your m:n code, since m:n forces the programmer to carefully worry about whether their code will break.
Re:Asynchronous IO in Rust by theseoafs on Wednesday September 16, 2015 @11:29PM (#10231425)
Maybe, if my program has a lot of shared mutable state. I'm smart enough to avoid that though.