4 ms·
> First, Rust prefers unique ownership and acyclic data structures. You can make cyclic structures work if you use RefCell and Rc and Weak, but you're giving up
by yxhuvud 6y ago
> First, Rust prefers unique ownership and acyclic data structures. You can make cyclic structures work if you use RefCell and Rc and Weak, but you're giving up the static guarantees that the borrow checker gives you in favor of a bunch of dynamic checks for 'is this in use' and 'is this still alive',
One way to get around that is to instead of doing it like the very structureless async way actually impose lifetime restrictions on the lifetimes of async entities. For example, if you use the ideas of the structured concurrency movement ([x], for example but it has since been picked up by kotlin, swift and other projects), then the parent is guaranteed to live longer than any child thus solving most of the problem that way.
[x] https://vorpus.org/blog/notes-on-structured-concurrency-or-go-statement-considered-harmful/ https://vorpus.org/blog/notes-on-structured-concurrency-or-g...
- mratsim 6y agoThe structured parallelism movement predates structured concurrency by years and needs a similar push. It's from 2004 with the X10 parallel language and then Habanero in Java via their "async-finish" construct I wonder if your quote (structured XYZ or ABC considered harmful) is inspired by - https://conf.researchr.org/details/etaps-2019/places-2019-papers/2/Keynote-Unstructured-Parallelism-Considered-Harmful-Using-Structured-Parallelism- https://conf.researchr.org/details/etaps-2019/places-2019-pa...
- yxhuvud 6y agoWell the link I posted is older than your link from 2019 so I doubt that. The other direction may be possible. However, enither are definitely not the first having ideas along these lines - structures and logic like this can also be found in Erlang supervisors after all. And as for the quote, it is quite explicitly referring to Dijkstra and structured programming constructs in nonconcurrent settings.
- mratsim 6y agoX10 Programming language is from 2004, http://x10-lang.org/x10-community/publications-using-x10.html http://x10-lang.org/x10-community/publications-using-x10.htm... Habanero Java from 2011 https://www.cs.rice.edu/~vs3/PDF/hj-pppj11.pdf https://www.cs.rice.edu/~vs3/PDF/hj-pppj11.pdf
- yxhuvud 6y agoNo doubt. In any case, the author notes his main influences in footnote 3, and those are not part of that. It seems he has a more practical than academic background in this.