Hacker News new | past | comments | ask | show | jobs | submit login

I assume coroutines could be trivially implemented with sync_channel(0), which blocks the sender until the receiver takes the message. (And the receiver blocks until there is a message available.)

The 'generator' use of coroutines could be implemented with Receiver::iter, which is an iterator over a channel.

(As I understand it, coroutines are just a special case of channels.)

[Edit: see <http://doc.rust-lang.org/std/comm/> for channel docs]




Wouldn't that require the use of threads, and hence be very expensive?


Your link is broken - there is an extra ">" at the end.




Join us for AI Startup School this June 16-17 in San Francisco!

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: