17 ms·
Rust's 2018 roadmap
- steveklabnik 9y agoYou may have noticed a subtle change: what was previously called “epochs” is now “editions.” Lots of great stuff coming this year! As always, happy to answer any questions.
- the_mitsuhiko 9y agoWhat happened to "era"?!
- kibwen 9y agoThe bikeshed works in mysterious ways. :P
- username223 9y agoEra, epoch, edition, excretion, excrescence,... I'm looking forward to watching Rust's continued evolution in the new... whatever they decide to call it.
- the_mitsuhiko 9y agoShould have been "cycle" with a fancy name instead of number.
- steveklabnik 9y agoIn the end, all these words are similar enough that we had to make a call. We expect most people to say "Rust 2018" and not use any of these terms; we still need one to be the key in Cargo.toml and the flag to the compiler, so we couldn't just use nothing.
- cesarb 9y agoCould this be used to add an "Ord::clamp" or similar to the stdlib such that it's invisible (and thus wouldn't cause any conflict) to crates with an older "edition"?
- aturon 9y agoYes, it could! There aren't plans to do so yet, but it'd be worth spinning up a thread on internals about this.
- deleted 9y ago[deleted]
- Manishearth 9y agoI think for such things it's preferable to just have a `clamp` method as a static method, i.e. you call it with `Ord::clamp(foo, bar)` instead of `foo.clamp(bar)`. But yes, it could. Generally the trend seems to be to still try to avoid having actual breakages in the editions unless we _have_ to, and this seems like one of those cases where we don't. That said, adding Ord::clamp doesn't technically count as a breakage for Rust, Rust's stability guarantee does not include "we added a method to this trait/type and now you have to disambiguate via UFCS" or "we added a thing to this module and now you have to alias your import" because it's not really possible to have that stability guarantee and continue to evolve the stdlib. That said, given that Ord is in the prelude, the bar for adding stuff to that is much higher. And Rust also cares about the impact of not-technically-breaking changes like these, so we definitely wouldn't just add it as a method.
- squiguy7 9y ago> You can use old editions indefinitely on new compilers; editions are opt-in. This is great to hear! A best-effort backwards compatibility guarantee is important to have for a language that has a lot of development.
- nothrabannosir 9y agoThanks for keeping to normal, obvious names and reducing the cognitive load. I’m not a fan of unnecessary idiosyncrasies so this is a welcome change.
- pas 9y agoFor me epoch is more readily associated with new version new features, whereas edition is more like format, such as Mobile edition, Tablet edition, etc.
- pknopf 9y agoGo is making a large push to wasm as well. There is a branch/fork with a near complete wasm Go compiler. I'm interested in seeing how Rust and Go will compare in the future of the web. Who will win? ;)
- woah 9y agoDo they ship a GC with every webpage then or am I misunderstanding how it works?
- the_mitsuhiko 9y agoFor now I think every wasm go module will have its own GC.
- pknopf 9y agoEach module has to have it's own GC. In my experience, it's been easier to integrate two languages that have GC (JavaScript and Go) than two languages where only one is GC'd (JavaScript and Rust). What will the interop with Rust and JavaScript look like? How will pointers be managed?
- the_mitsuhiko 9y agoSince JS and Go do not have the same GC you have the same issue there.
- pknopf 9y agoGC's have some kind of inherit reference counting which makes releasing pointers safe, in any direction. You can't do that with C/C++ without something like glib.
- the_mitsuhiko 9y agoNot entirely sure what you are referring to or how it relates to the issue here. If you have two separate heaps (what you have between go and JS) then they will be collected separately. As such you need to somehow keep objects on the other side alive. Worst: in Go the language does not guarantee that the GC won't compact (it doesn't do correctly though). As such you can't even pass pointers to JavaScript, you need to create handles. I played around with both Go and Rust from Python and the garbage collection made things harder not easier. Now we write lots of Rust modules for Python and managing memory is pretty easy. We have Python wrapper objects that keep one pointer alive.
- Ygg2 9y agoLooks neat. Any notes on const generics e.g.`Array[T, N]`?
- kibwen 9y agoThe tracking issue for const generics is here: https://github.com/rust-lang/rust/issues/44580 https://github.com/rust-lang/rust/issues/44580
- the_mitsuhiko 9y agoOne of the biggest issues with looking at tracking issues for me is that it's impossible to judge either priority or complexity. This one for instance is a good one. Tags say implemented and approved, the checklist is mostly docs. Yet it looks like from the discussion that this issue is closer to not landing at all in this form than landing.
- kibwen 9y agoAs with many large features, people with their heads down will be working on it for a long time without much fanfare, until suddenly the feature appears in a mostly-usable state shortly before it is able to be stabilized. Not much solace for the people who want to be able to predict when features will land, though the tracking issue should at least give some idea as to which developers are prioritizing this so that one can contact them directly for more information.
- Ygg2 9y agoAs far I understand the RFC won't allow for `Array[Y, N]` (or `Array<T, N>` in Rust parlance) note eddyb's comment: Note that all of this should allow impl<T, const N: usize> Trait for [T; N] {...}, but not actually passing a constant expression to a type/function, e.g. ArrayVec<T, 3>. What I'm actually looking is `Array<Y, size_of::<T>>` for support for data structures that vary depending on size of `T`.
- tatterdemalion 9y ago
- kvark 9y agoWhat I'm missing here is why we need to market it as a distinct Rust 2018 release. Do we have breaking changes that require a new epoch/edition? The "Language improvements" section doesn't clarify that. I just hope there is substance in this push, a real technical reason for a new release, not a marketing one.
- steveklabnik 9y agoMarketing reasons are just as "real" as technical reasons. Editions can do two things: * add new keywords * make lints go from warn to deny Both of these things are "breaking." An example of the former is the "catch" keyword, allowing you to use ? inside a block rather than for the whole function body. An example of the latter is the module changes; the older style will be a warning in 2015 and an error in 2018.
- kibwen 9y ago> Both of these things are "breaking." Though to re-emphasize the OP, all such breakage is opt-in (via compiler flags and/or Cargo.toml), and crates on different editions can be mixed freely. There's no enforced migration or involuntary backwards-incompatibility.
- steveklabnik 9y agoYes, that's what I meant with the quotes, thank you.
- aturon 9y agoThere are changes that require a new edition, particularly around new keywords. However, to be clear, editions are primarily a marketing/communication/project management tool. They give us a way to try to bring together a number of threads of work into a coherent whole, with a high level of polish across the board (including docs and tooling), and then to present that work to the world with a clear story. It's worth comparing this to the recent Firefox Quantum release, which was likewise a singled out release on the normal train process that brought together a number of important changes, marketing/communication, and a high level of polish.
- ch4s3 9y agoI like that they are targeting CLI apps[1], it seems like a great fit for Rust and a nice onramp for the ecosystem for newcomers. [1] https://internals.rust-lang.org/t/announcing-the-cli-working-group/6872 https://internals.rust-lang.org/t/announcing-the-cli-working...
- gandreani 9y agoLots of nice language improvements lined up for this year I haven't played with Rust but I like the ecosystem and transparency. Something that stands out is the Compatibility across editions section. Seems like they really thought this through: > you can be on a different edition from your dependencies. > Edition-related warnings...must be easily fixable via an automated migration tool (rustfix). Only a small minority of crates should require any manual work to opt in to a new edition > the progression of new compiler versions is independent from editions; you can migrate at your leisure, and don’t have to worry about ecosystem compatibility; These are huge! This really helps with ecosystem fragmentation. Other languages take note (please!) Another thing that stood out was the embedded as first class citizen: > Embedded devices. Rust has the potential to make programming resource-constrained devices much more productive—and fun! We want embedded programming to reach first-class status this year. This seems like the only thing on the list that might not finish in time for the year or will be sub-par. I don't know how much more work they need to do but embedded programming requires fine-tune memory management and access to special registers on a per-hardware basis. A lot of times these things fly in the face of assumptions many programming languages (and compilers) make
- steveklabnik 9y agoGlad to hear your enthusiasm! > might not finish in time for the year or will be sub-par. Yeah, these areas of focus are where we think we can make substantial improvements, but it may be something like how the webs services goal: last year we shipped fundamentals, this year we're shipping end-to-end awesomeness. So we may only get the fundamentals in place for this year, and maybe we'll need to focus on it next year too. We'll see!
- shaklee3 9y agoNot sure if you'll see this, but I really appreciate all the time you spend on here and other places answering questions. It makes a huge difference in getting people interested.
- steveklabnik 9y ago
- pimeys 9y agoI've been spending a good majority of my work hours with Rust and especially writing network services using Tokio. When things work there, it is very reliable, fast and has a tiny footprint with resources. Now reading the promise to get a stable async/await and also having Tokio 0.2 in the pipeline, I'd say async Rust might be ready for prime time. Don't get me wrong here, I enjoy using Tokio, but I'd say if you're not very experienced yet with Rust, and you try to mix an asynchronous database query and a web request together in the same event loop, or you wanted to use a reference to `self` in an inner future (which might suddenly want a static lifetime), you quite easily end up into trouble... Trouble like a couple of pages of errors, that are just not readable at all. And you get out maybe by knowing to use a `map_err` in that one future call after the second `then`, or by not referencing `self` in your futures... Now when reading the announcement, and I've read and understood the RFC's, the next generation of async Rust will help here tremendously. And I will definitely be amongst the first ones adding the changes to my code, to finally make it cleaner and nicer for the next developer to jump in.
- harpocrates 9y agoYou've changed my mind on adding special syntax for `async`, generators, and results (`?`). I previously thought it was a big mistake given that these all generalize as monads (granted, there is some ground to be covered before such an abstraction would fit in Rust). What I hadn't considered: specialized syntax leads to better error messages for the most common cases. That's probably quite a good thing, especially since descriptive error messages make me much more productive. (Not to mention that specialized syntax also acts as a type annotation of sorts too; a common problem I have in Haskell is figuring out _which_ monad a certain `do` block is using.)
- gilmi 9y ago> a common problem I have in Haskell is figuring out _which_ monad a certain `do` block is using. Does type signatures not help in that case?
- harpocrates 9y ago
- Symmetry 9y agoAs someone who does a lot of firmware I think I really need to explore more of what Rust brings to the table there. Interrupts are a major source of concurrency and I'd like to be fearless about those issues.
- quodlibetor 9y agoI'm not experienced in this space, but you might be interested in the Real-Time For the Masses[1] project. The author of that is the lead of the embedded devices working group. 1: http://blog.japaric.io/rtfm-v2/ http://blog.japaric.io/rtfm-v2/
- zanny 9y agoHeres just hoping that Mozilla is prepared to take responsibility for what they are trying to accomplish in the long haul. A lot of companies have tried to make products that are both infinitely backwards compatible and always supported while still introducing breaking changes like this. It quickly becomes a giant internal mess of trying to figure out what the most common denominator of feature requirements to implement new things is. Developers will start making ergonomic decisions in their changes (well, it could support 2021, but I want a 2024 feature so I'm going to use it and peg this feature to 2024 minimum) and new changes need to be tested against every different language iteration. This might seem like the best answer now, I just hope its not biting off more than anyone can chew in 2030. C++ had an era of malaise where conflicting implementations of the standard library across a dozen+ platforms led to the complete abandonment of it by the mid 2000s and it took Herb Sutter and friends to bring C++ back from the dead with one unified single truth of C++ with concrete compiler flags and tons of caution before adopting anything new to make sure all participants were capable of fielding it quickly enough to avoid the ecosystem fragmentation of the past. Rust is advantaged today with only one major implementation, but if mrustc or other alternative Rust compilers become popular mixing those with epochs / eras / editions can spell disaster for language portability. Its not an impossible task, but it is definitely a huge one. And its not the kind of work hobbyists will ever be willing to put up with in the long term, and its the kind of work that requires extraordinary familiarity with the whole of rustc, its design process, the RFCs, LLVM, etc. Its its opposite kind of work to what you put on the easy issues list for new contributors. It is the primary reason why most software staggers its releases and depreciated support. Why Microsoft dropped Windows XP at all despite its wide adoption. Because even with billions of dollars of cash on hand trying to keep multiple parallel interconnected but distinct code paths functioning while both securing and improving them in isolation or together is in the highest echelons of software complexity and difficulty.
- steveklabnik 9y agoSo, two things: > Heres just hoping that Mozilla is prepared Rust is an open source project Mozilla contributes to heavily, it's not a Mozilla project. This is the Rust project's problem, not Mozilla's problem. (For example, Mozilla employees, of which I am one, are a minority in governance these days. We're the largest single group of people by employer, but are at 50% representation on the core team and are something like between 10%-20% of the rest of the teams, which have just as much jurisdiction over Rust as the core team does.) > It quickly becomes a giant internal mess This is why, as noted elsewhere in the thread, editions can only tweak the frontend of the compiler. By the time you hit MIR, the main intermediate representation, all edition differences are gone. This is for both compilers and humans. As you rightfully say, if we allowed arbitrary changes, it could significantly increase technical debt. But it'd also be very hard for humans to understand as well. We won't be fundamentally changing what Rust is for these reasons.
- smoe 9y agoI started learning Rust over the weekends and I think the second edition "The Rust Programming Language" is among the best introductory books on a programming language I have read (well half way so far). As someone not only new to Rust but also systems programming in general I especially appreciate that the chapters include actual reasoning about why things are how they are in Rust and that they seem pretty open about drawbacks of the choices. As well as the use of precise language instead of trying to be too cute and overly beginner friendly. An example for this is the lengthy page on Strings: https://doc.rust-lang.org/book/second-edition/ch08-02-strings.html https://doc.rust-lang.org/book/second-edition/ch08-02-string... It really makes me feel you want me to understand what I'm doing from the start instead of getting a generic app out of the door as quick as possible and then tediously figure out the next basic steps from screencasts, scattered blog posts etc. Also big plus for having the book and api doc available offline by default! I'm going to try to come by #rustdoc and see if there something I could contribute.
- sharpercoder 9y ago> [...] include actual reasoning about why things are how they are in Rust and that they seem pretty open about drawbacks of the choices. This trait of documentation (the "why" & openly discussing pros and cons) seems to be a property of great systems being well-documented.
- derefr 9y agoI'm not sure—I think it's more, in this case, that Rust assumes the developers learning about it have specific goals: namely, to evaluate Rust vs. C/C++. So every resource that teaches Rust couches the discussion in terms of justifying why the particular design being presented is better (from the Rust maintainers' perspective) when compared to designs in existing languages, even if it makes other sacrifices to be such. I would contrast this to e.g. the Erlang documentation. Erlang/OTP is a great system, and it's well-documented... but the documentation doesn't actually go into the "why" of various choices (e.g. why the BEAM has a module table with exactly two slots per key; why binaries are shared at ≥64 bytes; why clusters are fully connected; etc.) But I think this makes sense, given the differing approach: unlike Rust, the Erlang/OTP platform is trying to facilitate an abstraction where you just write high-level declarative-ish code, and then improvements to the platform will make that code perform better over time. Rust documents its decisions because it expects you to be someone who wants to know those things in order to make precisely those decisions (except you're choosing a systems language, rather than designing one.) Erlang leaves most of its internal implementation as a black box, because it expects you to treat it as a black box and derive advantages (in e.g. maintainability) from doing so.
- tiuPapa 9y agoDo we get the fearless concurrency part of rust on wasm?
- skybrian 9y agoWebassembly (and JavaScript) are single-threaded. The platform has web workers, but they are more like processes since they mostly don't share data. There do seem to be some proposals to add threads, though. Also, it's possible (but hard) to build cooperative multithreading on top of it; apparently Go is going to do that.
- GolDDranks 9y agoNote that there is also single-threaded concurrency, since concurrency is not parallelism. The upcoming async stuff is going to help with this.
- Shoothe 9y ago> Tooling improvements For me that's the biggest issue currently with Rust. Type inference via "let" only makes it harder as I can't really know what type a certain variable or expression is without carefully tracking docs. I've tried two Rust plug-ins for VS Code and even though they installed required dependencies I still couldn't have proper list of members when pressing "dot" and without that I feel like programming in the 90's.
- fnord77 9y agointellij's rust plugin is pretty good at type interference. Also sometimes I just let the compiler tell me by forcing the let variable to something that it is obviously not: `let not_a_string: String = get_something_that_I_have_no_idea();` error [4242]: expected type String, found type &*YouWouldNeverHaveGuessed
- Shoothe 9y ago> Also sometimes I just let the compiler tell me by forcing the let variable to something that it is obviously not: Ha! Very clever! Thanks.
- deleted 9y ago[deleted]
- w4tson 9y agoYou can get feedback before the compiler kicks in by asking IntelliJ to explicitly define the type. It’s a trick I used quite a bit when playing about with rust, and Kotlin actually. Alt + Enter should invoke intentions pop up, you can do it from there. (I think)
- pimeys 9y agoThis works quite well, until you're dealing with stuff such as `AndThen` with 10 different nested futures. Here, again, async/await will be a great help.
- tototomtoboro 9y agoHave you tried https://marketplace.visualstudio.com/items?itemName=rust-lang.rust https://marketplace.visualstudio.com/items?itemName=rust-lan... ? You will need the rls from nightly but its working very nicely for me.
- swfsql 9y agoI'm an average programmer, but I honestly don't get the goal of inclusiveness [edit: from the Rust 2017 Survey Results] > Diversity and inclusiveness continue to be vital goals for the Rust project at all levels. I mean.. lifetime checks won't stop working if you don't consider yourself heterosexual or anything o.O The two matters simply don't mix in my head
- nemothekid 9y agoIt's less about goals of the technical project, and more about goals of the organization. Rust the language is written by people, The Rust Team, most of whom I'd imagine are volunteers. In order to guarantee the life of the project, its important for potential contributors to not only feel comfortable using the language and writing code, but also feel comfortable in discussing the future potential features and use cases for the language. It is important for projects, now, to state their goals upfront and be clear, especially when you could have 1000s of contributors from all over the world. This is something that's new for software projects, but as open source becomes larger and more diverse its becoming more necessary. The alternative has been a community based loosely around some invisible set of rules that alienates or drives away potential contributors or sparks some drama that ends up on the top of Reddit/HN/etc. Lifetime checks will stop working if the project gets abandoned over political issues.
- swfsql 9y agoI see, but this is still a political issue. Maybe a lot of minorities people just voted "no" in that survey question. Because.. why excluding people based on their skin color is discriminatory, but including people based on their skin color is not discriminatory?
- matthewmacleod 9y agoYou’ve described something that isn’t happening and won’t happen.
- awestroke 9y agoDiscrimination, noun: > the unjust or prejudicial treatment of different categories of people, especially on the grounds of race, age, or sex. Is it unjust to make sure people from a minority do not feel alienated?
- AceJohnny2 9y ago> Embedded devices I'm excited about this. In my experience, embedded (and by extension, a large part of kernel/driver programming) is the last stronghold of C, because it's a place where you really need fine-grained control of your environment and C gives you that by default. It's my day-to-day workhorse, and I often feel like I'm stuck in the dark ages still dealing with issues of tooling and expressiveness that CS has solved long ago. Free me!
- anderspitman 9y agoI love C for it's simplicity, but I'm super excited to see Rust get a foothold in embedded as well.
- xudaiqing 9y agoCan't agree more! Through i am afraid there hugh work to be done before i can use it at work since i find we are increasingly rely on vendor's sdks to workaround hardware limit and slicon errors
- _pmf_ 9y agoHere's my wishlist for embedded: first class hierarchical state machines, saturated arithmetic, fixed point types. In bare metal scenarios, these are much larger areas of potential errors than any ownership issues, since often, any dynamic allocation is restricted to a mailbox/queue primitive while everything else is statically allocated.
- krylon 9y agoOkay, after two failed attempts (mainly due to lack of motivation, I hasten to admit), I think it's time for me to learn me some Rust. I spent a long time working mostly with dynamically typed languages, but over the past few years, I have slowly drifted back into statically typed territories. At home, I have used Go a lot, at work, I have grown to like C#. Rust kind of looks like the next logical step along that trajectory, doesn't it? And I get the impression that people who took the time to learn Rust enjoyed it very much. So here's my delayed new-year's resolution (I am the ____ing king of procrastination!): I am going to learn Rust and I am going to like it (I hope)!
- kibwen 9y agoIf you have any questions, feel free to come ask at /r/rust, where we strive to be moderately less of a shithole than reddit in general. :)
- littlestymaar 9y agoThe same way a 4 star hotel is «moderately less of a shithole» than a slum ;)
- anderspitman 9y agoI've had a couple false starts over the past 2 years or so as well. This time I'm determined to reach "critical mass" where I'm comfortable reaching for Rust when I need to hack together a new CLI tool, web service, whatever. I won't quit this time if you don't.
- technological 9y agoMe 2, Let me know if you want to learn together by building a CLI tool or stuff. I think it would be great to help each other and learn along the way.
- HumanDrivenDev 9y agoSome honest criticism. I'm not a guru, but I've used a fair bit of F# and modern C++ in a commercial setting, so a lot of things in rust weren't too surprising. I learned about the different kinds of strings (they make sense, even if they're poorly named). I learned the strict borrowing rules. I learned the strict mutability rules. But try as I might, I can't bring myself to care about the difference between the ~190 different types of iterator[0]. I think I should just be able to use a Iterator trait, but I can't get any of those concrete instances to match up. It very much triggers my "I don't care reflex" in a way the other stumbling blocks really didn't. [0] https://doc.rust-lang.org/core/?search=Iter https://doc.rust-lang.org/core/?search=Iter
- dbaupp 9y agoAll those iterator types are exactly the same as C++ having std::vector::iterator, std::vector::const_iterator, std::deque::iterator, ..., and exist for similar reasons: mostly zero-overhead abstractions. (This is even more visible in the range proposals for C++.) Using concrete types for every adaptor means all the steps in a iterator transformation pipeline are statically known and (importantly) obvious to the compiler, and thus is highly amenable to inlining/optimisation to get it down to something close to a plain 'for' loop. If you're willing to forgo that performance, it's possible to just put everything behind a pointer/virtual call with a Box<Iterator<Item = ...>>, which ends up more similar to sequences in F# etc. It does seem as if the motivation for this design isn't discussed in the documentation.
- Ainak 9y agoGood
- EugeneOZ 9y agoEditions - great thing, thank you VERY much! I love this language and people who work on it!
- nandita95 9y agoI absolutely loved rust and it is very easy to use
- hi41 9y agoThis post is so well written. It must have taken a lot of time to do this write-up. Is it written by many people or just a single person?