148 points · by mithrilskeleton · 11y ago · 102 comments
How long do you (the Rust community) expect Rust to remain backwards-compatible? That is, once 1.0 ships, on what sort of approximate timescale would significant effort be made to ensure code that worked with the initial release (assuming no experimental features / libraries in use) would keep working? On the order of months, years, decades?
I'm interested in writing some random things in Rust, but very much not interested in _re_writing Rust code in newer Rust. This probably means it's still too early for me, if the standard library is expected to expand soon after 1.0. But given e.g. the prevalence of Python 2 versus Python 3, it seems like there's quite a lot of people who think similarly.
Background: I used to write Firefox extensions and things like that. Stopped being active around Firefox 4, when they declared that they are fine with breaking backwards API compatibility (and, IIRC around that time or soon after, put in arbitrary checks to force recompilation). This was just before the short releases started.
The hope is for all of 1.*. I forget what the plan is for 2.0, but I think we want to keep things the same (mostly).
In practice there will be minor breakages due to unavoidable bugfixes.
Expanding the stdlib will never break your code. All changes now are being made with backcompat in mind; older code should never have to update.
Right, but how long is that 1.
? 2.0 is a good time to have (hopefully small) backwards compatibility breaks, so having a rough idea of an order of magnitude of the timespan would be helpful.> Expanding the stdlib will never break your code. But having it obsolete the non-standard libraries (from e.g. crates.io) will. Code is, unfortunately, not static; things suffer from bitrot, as the toolchain etc. changes.
Why would you have to rewrite code because of an expanding std lib?
There needs to be more experience with widespread use and multiple releases, to see how far that backcompat can be held. Perhaps after 10 releases, it should be a lot more clear whether or not a Rust 2.0 will be needed.
That may be a misfeature. One would like to reduce the need for unsafe code, not make it easier to write unsafe code. Unless you're talking to hardware or another language, you should not need unsafe code. If you do, the language has a problem. I'd suggest identifying each use of unsafe code in a large system and then looking at why it was necessary.
It's important to keep Rust from going off into template la-la land, as C++ did. C++ generics are starting out with roughly the complexity level it took C++ two decades to achieve. Try to keep the metaprogramming fanatics from driving the language design, please. That doesn't end well.
... or if you're implementing safe abstractions on top of data structures or synchronization protocols that the type system cannot automatically infer to be safe.
Of course that is going to be a smallish subset of Rust programmers that gets smaller with time as the standard library fills out, but an important one!
For those who aren't as familiar with Rust, the std::sync [0] module can be a fun way to cut your teeth.
For example, here's the implementation of Mutex.lock [1]:
pub fn lock(&self) -> LockResult<MutexGuard<T>> {
unsafe { self.inner.lock.lock() }
MutexGuard::new(&*self.inner, &self.data)
}
Note that the self argument is immutable: "&self" instead of "&mut self". This may seem odd: doesn't locking a mutex require a change to its innards? Which is why you should not be surprised to see the unsafe, which allows us to bend the immutability of &self in order to acquire the lock.In fact, how could it be otherwise? Rust prevents there ever being more than one &mut to something, so if the signature of Mutex::lock was "&mut self", there could only ever be one usable ref to the Mutex! That would be pointless, of course -- multiple threads need to have references to the mutex.
We're still safe, though, because the "mut-aliasing" that Rust normally prevents via the borrow checker at compile time is being replaced with a run-time mechanism that achieves the same thing via the Mutex and the MutexGuard [2].
[0] http://doc.rust-lang.org/std/sync/index.html
[1] http://doc.rust-lang.org/src/std/sync/mutex.rs.html#196-211
[2] Well, strictly speaking a RwLock is a closer runtime approximation to the borrow checker's rules, because it allows multiple simultaneous readers: http://doc.rust-lang.org/std/sync/struct.RwLock.html
In a sense, what you need there is not "unsafe", but "atomic", declaring that the contained operation is atomic. That's less general than "unsafe", and atomicity of code is checkable.
After giving it a few hours with the IRC channel riding shotgun and hello_world.rs still crashing on Windows, I've again hit snooze of Rust. A pity too... I am quite re-interested after seeing some Rust demos/discussion at PyCon.
Hey you reading this! Yeah, you! If you happen to be an expert in integrating native compilers with MSVC, we desperately need your help!
I did some REALLY REALLY MINOR code in Windows before doing it on Ubuntu, and I had no issues dependent on OS.
Obviously my system is a hostile environment for it. OTOH it's a pretty ordinary enterprise Win 7 box with plenty of dev tools happily running. I'm sure there is a series of steps to fix it. So one aspect of "Better Windows support" for me means the installer doing a better job at getting things going and complaining about missing things, incompatibilities, etc. I do hope mine in an exceptional case.
Have had 0 issues, and I have no idea what the fuss with windows is about. 0 ICEs nowadays, and it works like a champ speedwise (obviously)
Compared to Ruby, Rust is basically C#, windows wise. In the past I have gotten ICEs and shit, but nowadays its perfect.
Would you mind filing a bug about this? (with as much configuration details as possible). Thanks!
Now we only need to dependencies for Servo to move along and it could work. I would imagine this would be a lot of work for the OpenGL implementation they use.
Any cool projects I can take a look at?
Would anyone like to compare Rust to ATS instead? Maybe Erlang? Anybody??
ATS is more like a safe version of C wrapped in ML syntax vs Rust as a safe version of C++.
ATS is lower level. You can do memory safe pointer arithmetic whereas in Rust you'd use unsafe blocks.
Some things are implicit in Rust but explicit (and more verbose) in ATS. For example, Rust has destructors for RAII whereas ATS requires manually calling functions to clean up resources. The type checker tells you when you need to do this (via linear types) but programmer still needs to do the call.
Borrowing is automatic in Rust. In ATS it requires keeping track of borrows in proof variables and manually giving them back. Again the type checker tells you when you get it wrong but it's more verbosity.
ATS has a restricted form of dependent types - Rust is not dependently typed.
With current implementations, ATS compiles to C which can be compiled independantly of an ATS install. You can ship the C code to someone to build without them needing ATS. Rust uses LLVM.
The two languages feel very differently when programming.
Well, to be fair, talking about a language is also about talking about what makes it different from others.
Go is mentioned 45 times in that thread about Rust...
There are plenty of people in this thread also complaining about aspects of Rust and its development.
Meaning: GO was dead at birth from out of the sphincter of the NSA.
Go has been ready for years.
a := mk(array[10] of int)
Given this lineage, it seems disingenuous to compare the ages of the two languages. Modern Rust is to early Rust as Go is to Newsqueak.Rust will be stable in 4 weeks, Go was stable several years ago. So what? If we judged languages by how early they were stable, we would all be writing Fortran 57, Algol 58, and COBOL 60.
The team still seems to be changing stuff like crazy even after the "stable beta" release.
it does have some marquee names behind it, though. I suppose if you squint, that can make up the difference.
It's ready when people use it in production.And that's the case so it's ready.
> it does have some marquee names behind it,
So does Rust,or are you saying Mozilla isn't a strong brand?
I don't think its fair to compare both anyway.
Rust looks like it wants to compete with C++, while Go is used by scripters coming from Ruby,Python,Js and PHP. Go devs aren't interested in memory unsafe programming.
Any gains from rusts expressive type system are lost by all the memory lifetime annotations imo.
I still think rust is probably going to be the best language for embedded software like router firmware, as they need to be fast, low overhead and secure.
I wanted to give rust a crack years ago, but I am glad I didn't because it would have required constant updates for anything serious.
(See my valid but then NSA downvoted answer to the question below regarding GO vs. Rust that no one else could answer and were forced to make jokes about -- if you are wondering what I mean.)
Sorry rust thread. :(
(now kicked off the front page)