News for hackers. Stuff that matters.
Re:How Rust Is Tilde’s Competitive Advantage [pdf] by lmm on Tuesday February 06, 2018 @02:47PM (#16318949)
async/await means you mark all your yield points explicitly; rather than having the runtime implicitly preempt you whenever it chooses, you mark the points at which task switching can happen, and at every other point it's impossible (equivalently it's as though any block of code that doesn't contain an "await" were a critical section). The syntax strikes a nice balance, making these markers as lightweight as possible but no lighter: you don't want the yield points to be completely invisible, but you don't want them to distract too much from reading through the straight-through happy-path control flow.

I find that having one implicit, pervasive, uncontrolled effect in a given piece of code is ok, but having multiple uncontrolled effects is very much not ok, because the ways those effects will interact can be very surprising. E.g. https://glyph.twistedmatrix.com/2014/02/unyielding.html gives an argument for using explicit async/await rather than go-style implicit (green) threads, in terms of how task switching will interact with state mutation. You can make similar arguments in terms of how task switching interacts with error handling or logging or database transactions or... - one uncontrolled effect is fine, multiple uncontrolled effects cause chaos when they interact. Unfortunately the kind of examples where one can see multiple effects in a single application tend to be quite big by their very nature (and if your app is small enough to only need to have one kind of effect, then using a language in which that particular effect is uncontrolled is probably fine, perhaps even a good idea).

Re:How Rust Is Tilde’s Competitive Advantage [pdf] by kbenson on Wednesday February 07, 2018 @12:35AM (#16322431)
> async/await means you mark all your yield points explicitly; rather than having the runtime implicitly preempt you whenever it chooses, you mark the points at which task switching can happen, and at every other point it's impossible (equivalently it's as though any block of code that doesn't contain an "await" were a critical section).

That's not how I understood it at all. I always assumed that it just promoted explicitly acknowledging when the effect of an async block would be present, but that the normal yield points (traditionally syscalls and IO requests in OS threads) generally still held for the actual execution of the other code.

I mean, if we aren't allowing separate code paths to execute (and thus reducing wait on resources such as IO), what's the point?

Re:How Rust Is Tilde’s Competitive Advantage [pdf] by lmm on Wednesday February 07, 2018 @04:30AM (#16323256)
> That's not how I understood it at all. I always assumed that it just promoted explicitly acknowledging when the effect of an async block would be present, but that the normal yield points (traditionally syscalls and IO requests in OS threads) generally still held for the actual execution of the other code.

Put it this way: the language implementation won't preempt you except at your explicit yield points (some standard library functions for things like I/O will and should be yield points that you have to call with async/await). If the language implementation happens to be running as a userspace process on a preemptive multitasking OS then it will still be subject to the same preemption rules as any other userspace process on that OS, but if anything this is usually counterproductive (e.g. priority inversions are almost guaranteed); recommended practice when working in green-thread-based systems is to run with one thread per CPU core and maybe even pin threads to cores if the OS lets you do that, because the language's own M:N scheduling will keep those threads fully occupied and OS scheduling is only going to get in the way.

Re:How Rust Is Tilde’s Competitive Advantage [pdf] by kbenson on Wednesday February 07, 2018 @10:15AM (#16324901)
I think I see what's going on here. You're answering "in the context of Go" (which is correct, and what was corrected) and I'm interpreting it as a general statement about what async/await mean as general concepts (i.e. in other languages as well). My mistake, I wasn't paying close enough attention. :)
Re:How Rust Is Tilde’s Competitive Advantage [pdf] by kbenson on Wednesday February 07, 2018 @06:18PM (#16328871)
s/and what was corrected/and what was requested/ Ugh, so many typos or word mistakes lately. :/
Re:How Rust Is Tilde’s Competitive Advantage [pdf] by dilap on Tuesday February 06, 2018 @11:49PM (#16322307)
Having used both, I'd be pretty shocked if anyone found Twisted to be easier to reason about or less prone to bugs than Go...
Re:How Rust Is Tilde’s Competitive Advantage [pdf] by laurencerowe on Wednesday February 07, 2018 @12:54AM (#16322498)
Twisted predates async/await syntax in Python.
Re:How Rust Is Tilde’s Competitive Advantage [pdf] by ddorian43 on Monday February 12, 2018 @07:46AM (#16358239)
Isn't gevent still better than async/await ? (if it had core support it would be, kinda like golang)