News for hackers. Stuff that matters.
Re:Green threads explained in 200 lines of Rust by snissn on Wednesday June 12, 2019 @10:44AM (#20165153)
> a simple but working example
Re:Green threads explained in 200 lines of Rust by amelius on Wednesday June 12, 2019 @10:48AM (#20165205)
Yeah, of course, but how would you work this type of code into something that can be used in production?

The goal should be to have a green thread library that you can just use without thinking about registers or assembly.

Re:Green threads explained in 200 lines of Rust by arnarbi on Wednesday June 12, 2019 @11:21AM (#20165517)
> how would you work this type of code into something that can be used in production?

You wouldn't. There are production-ready solutions to this in many languages.

> The goal should be to have a green thread library that you can just use without thinking about registers or assembly.

The goal here is very explicitly to explain a concept by example, which is largely incompatible with what you say the goal should be. I think the author did a very good job.

Re:Green threads explained in 200 lines of Rust by amelius on Wednesday June 12, 2019 @11:22AM (#20165526)
> I think the author did a very good job.

I wasn't questioning that!

Re:Green threads explained in 200 lines of Rust by masklinn on Wednesday June 12, 2019 @11:28AM (#20165595)
> Yeah, of course, but how would you work this type of code into something that can be used in production?

Why would you?

> The goal should be to have a green thread library that you can just use without thinking about registers or assembly.

No it should not. That's a completely separate (and mostly incompatible) goal than TFA's, which is educational.

Re:Green threads explained in 200 lines of Rust by mamcx on Wednesday June 12, 2019 @04:06PM (#20168723)
Going for "toy" code to production ready is hard.

Also, rust already have several options for concurrency/parallelism that are more idiomatic.

The only reason I see is to have a coroutine library for build a language, yet I have wonder if I put a facade of Actix actors or similar for this case...

Re:Green threads explained in 200 lines of Rust by nwallin on Wednesday June 12, 2019 @08:43PM (#20170852)
> Going for "toy" code to production ready is hard.

Too true. I recently implemented a feature, and I had a standalone working version 90% complete in a day or two. Getting the thing solid, tested, and integrated took the better part of a month.

Part of that, I think, is our education model. Every project I ever had in school was started from scratch, I worked on it for a short period of time, turned it in, and never looked at it again. I got really good at that. I can write a toy version of a hard problem in a very short period of time. But I'm terrible at integrating those things into a larger whole, and I know for a fact I'm not alone in this.

I think it's a huge problem that corporations think that a CS degree is job training and won't hire you if you haven't done it, but colleges think it's about abstract concepts and research and don't teach engineering principles.

Re:Green threads explained in 200 lines of Rust by heyzooos on Wednesday June 12, 2019 @11:18AM (#20165477)
> I’m not trying to make a perfect implementation here. I’m cutting corners to get down to the essence and fit it into what was originally intended to be an article but expanded into a small book.

lol