Rust 2018: an early preview
internals.rust-lang.org
internals.rust-lang.org
It's not that it's difficult to use, but there's just too much stuff shoved into the drawer, and I really just need some silverware.
my two cents. All the rust I've written is just rewrites of things I originally wrote in other languages. I'm a little disappointed to realize that I'm glad I don't have to write Rust for a living.
I also think the 6-week release cycle is WAY too fast for a language with the low-level ambitions of rust. Granted, it's not like stuff is being broken every six weeks, they're doing a wonderful job with backwards compat in mind, but just the sheer volume of language delta is a lot for the average programmer, I think. Maybe I'm just a below average Rust hacker and maybe I'm just not "getting it"
A major OS vendor states "if you want to target my OS here is the language".
(talking as someone who was working on a C-to-C# transpiler for PSMobile to port my C game engine to it before Sony axed it :-P)
Yet all other major mainstream language also are, with an history of 20 years of versions, huge libraries and quite a few breaking changes between them.
Picking up Python as an example since it is deemed simple, there is quite a stuff there to learn in 167 pages of language reference, 1942 pages of library reference, major community libraries, keep track of the breaking changes between all versions or when were specific features introduced.
By the way, it's probably a bit early to say that Go's dependency management system is broken, and anyway it has little to do with the language's complexity.
rust is so damn good and the team behind it has delivered so much we hold them to impossible expectations.
I am currently teaching a course where Rust is the main language and this is already a problem. Some recent changes have made Rust more difficult to understand. E.g. impl in argument positions have are really opaque. For example, it is quite easy to explain and understand the difference between
fn foo<T>(t: &T) where T: SomeTrait
and fn foo(t: &SomeTrait)
because the type parameters are explicit in the static binding case. On the other hand, fn foo(t: &impl SomeTrait)
is really opaque. I know that it is an ergonomic win and provides consistency between impl in argument and return positions, but it makes Rust more difficult to understand for new language user. Other magical/difficult to understand semantics: automatic derefs in pattern matching, deref coercion, different drop orders for structs/local variables, impl coherency rules, the distinction between copy/move types, etc.Don't get me wrong, Rust is my all-time favorite language. But I agree that increased complexity is the most dangerous pitfall for Rust. I fear the day higher-kinded types are added and the catogory-theory fest will be added in addition to the existing complexity.
fn foo(t: &dyn SomeTrait)
&dyn SomeTrait and &impl SomeTrait are then more directly comparable. “&impl SomeTrait” should be read as “a reference to a type implementing SomeTrait”.It’s different from the angle-bracketed generic syntax you may be used to, but I think it’s generally superior. I certainly find it much easier to write and read than the generic syntax or generic-syntax-with-where-clause versions. Well, I say generally superior—but its potential downfall is the turbofish issue, that impl in argument place is not just sugar for the generic syntax. And thus that for now impl in argument place is arguably unsuitable for library code and only suitable for application code. We’ll see how that pans out.
You mention higher-kinded types: there is actually a plan now for a feature equivalent to HKT, generic associated types (associated type constructors), https://github.com/rust-lang/rfcs/pull/1598, and I’m glad; note when I say that that I was one of the few that campaigned before Rust 1.0 for explicitly not touching HKT for a few years purely for marketing reasons—they’re scary and will put people off Rust. But certainly I have encountered a couple of situations where generic associated types would substantially improve ergonomics in my HTTP and web work, and this is a proper Rust-flavoured take on the concepts behind HKT. I believe it will be good to have.
I am still a bit anxious about the volume of change happening, just as you, others, and graydon just now on the forum post.
e.g.
Type declaration
Function declarationThe audience for the edition isn’t just those who follow Rust closely, but for those who don’t. And even for those who do, we want to take a look at some of the things that make writing Rust feel differently in the last few months. Turns out the match stuff was good enough to stabilize a bit earlier, even though it was designed with all of these other features.
There remains a small part of me that enjoyed the explicitness of fighting the compiler to understand what type I was actually dealing with (forced learning).
C++ got that why by accretion of features.
Rust, on the other hard, removes non ergonomic syntax, or changes convoluted features to easier to grasp ones.
Even when it adds a second mechanism (e.g. async/await over futures) that's still a huge win, and nothing like the mess C++ is in.
C++ has been removing features as well, to the extent they don't cause major breaks.
There's also the confusion of looking at a `pub` declaration and not knowing whether or not it's visible to the parent module or visible to the world- at which point maybe you don't want a purely local visibility mechanism.
I may still end up writing it if it goes out in that form; I’m not sure. Certainly removing the need for `extern crate` reduces the probability of confusion for developers old and new after the dust settles.
(I'm not bothered by these changes personally, but I'm not really bothered by the status quo either.)
The introduction of NLL will make beginner's life easier, so will the changes to the lifetime variables and if writing async code, you should be counting days to get the async/await and pinning to the stable rust.
I'd like to know what changes here you think will make it harder to read and code Rust?
Then again, I have other horses to worry about.
The other thing is how past and future features/syntax are supported, like for the new modules systems. I will prefer to break things when it makes sense with new features well thought out rather than support different ways of doing something and have as many ways of writing it. At the end of the day with a full team it’s as many way we have to read and so to understand. And even thought your team has the same guideline it’s the same problem when we start to read open source projects all with different ways of doing things. I won’t want to have a language that don’t break things and features stack themselves across the years but rather a language that refine itself over time with only one way of doing things. We can see how it turned for C++ where the language is so big that you have different ways of writing it and like how Google has its own guidelines and others too. On the other end look how Swift look now.
Right now my feelings are not to add new features but to refine the language and the syntax. But I can be all wrong. I mean I have just starting to learn Rust. A syntax with some ideas from ReasonML for instance will maybe make it better.
On a side note I hope this comment comes not too raw I see many down votes. I am just expressing my point of view as a beginner. Right now I know many of my coworkers will be turn down with what I said in my first comment. And they will turn to Go instead. Which I am sure can be fine technically but I really want to see Rust succeeds and have even more Rustaceans!
It is hard to say "no" to some new language features because many of them are very very strongly motivated by incredibly compelling use cases. async/await is the big one. Rust's direction is nothing if not pragmatic, and async/await is kind of the obvious direction to head in if we want people to be able to write asynchronous code happily.
[1] - https://rust-lang-nursery.github.io/edition-guide/2018/statu...
But yeah, if you care, reading the RFC should explain that. It's been a while since I read it, but we had a procedural macro based version, but ended up with real language support for a reason.
E.g.
//do we write the type of MyBox like 'MyBox<dyn Debug>'?
struct MyBox<T : ?Sized>{
inner: Box<T>
}Then I learned it was garbage collected. I felt disappointed.
If you just want the text, you can use Links.
Websites that deserve it and I bother to use them, or lack alternatives, do get white listed.