4 ms·
Isn't the point of Rust to enable easy concurrency?
by Ar-Curunir 10y ago
Isn't the point of Rust to enable easy concurrency?
- bsaul 10y agoI think it's to enable safe concurrency. The problem is they decided to let others build the primitives for concurrency, on top of the stdlib. Which means the language didn't decide between actor vs futures vs coroutine vs event loop, etc..
- pcwalton 10y ago> Which means the language didn't decide between actor vs futures vs coroutine vs event loop, etc.. Having the language decide on one method of concurrency would make it useless for lots of people's purposes (including ours).
- stshine 10y agoOn the other hand, since these methods are not compatible it will create certain split in the ecosystem.
- msbarnett 10y agoThose splits are inevitable. There is no One Size Fits All concurrency primitive. Embedded devs and web devs have vastly different requirements. Either the split is "every use-case finds the primitive that works best for it" (Rust), or the split is "here's the blessed primitive, other use-cases can pound sand" (Go)
- Manishearth 10y agoMust it? In fact, I'd expect the reverse -- choosing a model for the language will make the ecosystem tied to that model For example, while tokio is being integrated with hyper, it does not affect the "usual" users of hyper at all, both in terms of API and in terms of what's going on under the hood, cost-wise. Having a blessed solution for async like tokio that is not in the stdlib seems to encourage folks to integrate with it, but not in an irrevocable manner; the core library stays intact and able to support potential other models in the future.
- stshine 10y agoSure, I do hope we can focus on one concurrency primitive, but the possibility that we may have async/await and coroutine at the same time seems kind of unfortunate to me.
- Manishearth 10y agoAFAICT async/await the way Rust intends to have it (plans are rough right now) basically coroutines with extra sugar to specialize it with futures. The core language won't know about event loops, it will just know about futures, and you wire up your async/await or whatever to the event loop yourself. As both in the context of concurrency will involve futures they will probably work well together.
- stshine 10y agoI'd love to see this goes well with highest performance.
- Manishearth 10y agoAFAICT It's all going to be a generator-like abstraction which is pretty zero-cost.
- stshine 10y agoThe real world is always more complicated, since cps carries stack in its arguments.
- Ar-Curunir 10y agoHmm. I guess the community will eventually decide on one particular primitive, hopefully soon.
- Manishearth 10y agoI don't think it's a good idea for Rust to choose a particular kind of concurrency primitive. Rust is pretty broad in its use cases, and choosing a primitive may end up restricting other fields. Remember that Rust used to have a libuv based green threading model, and it was removed for precisely this reason -- it affected some use cases in major ways. Rather, it is important for subcommunities to rally around particular sets of libraries. E.g. the web and I/O related libraries seem to all be going in the direction of integrating with tokio. This means a web programmer can use tokio and it will work smoothly. OTOH, a different subcommunity that uses a different set of libs may use stuff built on rayon and crossbeam.
- Ar-Curunir 10y agoThat's fair; it allows for lots of flexibility.
- deleted 10y ago[deleted]
- deleted 10y ago[deleted]
- bsaul 10y agoI hope the same, but i don't have great hopes. For a community to adopt a library as fundamental as this one would be, it would need to be of such a high level that i think only the language designer can create it ( or other really big names in the field). If you think of something like OTP, i don't see any equivalent anywhere else. Even akka isn't unanimously used as the foundation for server side dev on the jvm.
- steveklabnik 10y ago
- Lev1a 10y agoIf I remember right, Rusts approach for their stdlib is that the bare minimum is actually in there and everything else is to be supplied by libraries, like the getopts crate that was split from the stdlib AFAIK.
- steveklabnik 10y agoGenerally speaking, yes. This is driven by three things, largely: Rust has a very wide variety of use-cases, we don't want to stabilize a poor API forever, and Cargo exists and works well.
- mtanski 10y agoProblem? The goal of Rust is to be a general system programing language. In fact, Rust in the past had a runtime that included green threads a primitives; that ended up being a problem. The runtime and stdlib was only usable in some system programing task (defeating the whole goal).