Announcing Rust 1.2
blog.rust-lang.org
blog.rust-lang.org
I wonder if this is an irrational fear though. Has anyone here implemented a large project with many external dependencies (DB, data serialization, interfacing with other programming languages etc.) in Rust? If so, what were your learnings and would you do it again?
I find that the discussion about whether a programming language is "good" or not always focuses on the core features of that language and less on the actual system of support libraries that are available for it and that make it actually useful in a real-world setting.
Young ecosystems: lots of opportunity, but 'opportunity' also means pain for those on the other side of the chasm...
https://doc.rust-lang.org/book/ffi.html
https://www.reddit.com/r/rust/comments/3axeu8/whats_the_stor...
I guess the answer is that it depends on what libraries you'll need.
p.s. I love rust.
p.s.2 . It is completely logical and most of agree rust is in early adopt stage.
It's not by any means a conservative, "safe" choice (in the business sense); you'd be choosing an early-stage language, with everything that implies. But I think it's a reasonable choice for a new project starting today. And the community around it is incredible.
Although I find Rust very appealing I still see C++ as the better option, mostly
because I fear that Rust would lack good suppport libraries (e.g. for talking to
DBs, generating/parsing data formats such as JSON or for generating cryprographic
hashes) and that I would end up implementing many of those myself. As of today,
many Rust wrapper libraries (e.g. for BerkeleyDB) seem to be written by a single
author, which makes me wonder about their stability and maturity even more.
Rust is in its very beginning[1]. Only time can tell if it will have a rich set of support libraries that are stable and mature.It has one big advantage over C and C++ in this regard.It has a central repository for all the support libraries.
I always found it difficult to assess the stability and maturity of libraries for C or C++ found on the internet. Of course there are the standards, like libpng or zlib, and you know they must be good because so many projects use them. For more exotic tasks you are on your own. With a central repository, you can at least estimate the popularity of a certain library. crates.io shows a download count for example. Also many other popular languages have one
Java Maven
Perl CPAN
TeX CTAN
PHP PECL, PEAR
Python PyPI
Ruby RubyGems
R CRAN
Node.js npm
Lua LuaRocks
Haskell Hackage
[1] I know that Graydon started it over 5 years ago, but from user standpoint Rust is more a child of 2015.For Java there are commercial curated Maven repositories and I'm not aware of anything like that for C/C++. So Cargo can be an enabler for Rust in big corp.
Whether we like it or not most developers are hired by a company. And for most medium to large companies there is no way they are going to let a P2P system go through their firewall.
Many don't even allow developers to access official repositories which is why products like Nexus (repository proxy) exist.
For PHP PEAR is dead. Packagist is the de facto central repository for packages.
You don't need everything be pure Rust. Just use C libraries to fill in the gaps.
Hopefully more people share their stacks on http://www.stackbus.com/ (FYI, I build it) so that it help others to decide better.
Another is compiler plugins: it's much easier to stabilize an MIR than it is to stabilize the compiler's internal functions.
> cargo clean; cargo update; cargo build;
Updating registry `https://github.com/rust-lang/crates.io-index`
Compiling libc v0.1.8
Compiling regex-syntax v0.2.1
Compiling memchr v0.1.3
Compiling aho-corasick v0.3.0
Compiling regex v0.1.41
/home/john/.cargo/registry/src/github.com-0a35038f75765ae4/regex-0.1.41/src/lib.rs:394:34:
394:51 error: #[feature] may not be used on the stable release channel
/home/john/.cargo/registry/src/github.com-0a35038f75765ae4/regex-0.1.41/src/lib.rs:394
#![cfg_attr(feature = "pattern", feature(pattern))]
^~~~~~~~~~~~~~~~~
error: aborting due to previous error
Could not compile `regex`.
Looks like Rust 1.2 broke Rust's regular expression module. Somebody isn't running enough regression tests.Could you post your Cargo.toml?
[package]
name = "hello_world"
version = "0.0.1"
authors = [ "John Nagle <nagle@animats.com>" ]
[[bin]]
name = "hello_world"Adding a
[dependencies]
regex = "*"
and building works fine here... hm.(also that [[bin]] section is just repeating the defaults, you don't strictly need it)
Besides it having a bug (perhaps, it could have been messed up as they say from previously running nightly), what exactly looks "weirdo" about it?
(The failure mode is bad here. Instead of reporting a compiler error on `regex_macros`, it's trying to compile `regex` with the `pattern` feature enabled, as specified in `regex_macros` Cargo.toml.)
`regex` has worked on Rust stable since 1.0.
I notice you left C, JVM, and .NET off the list. What's the story for how you could run Rust on a JVM, or on a platform that has nothing but a C compiler?
I can believe that the Rust toolchain is pretty portable. But it's also big. Say someone wants to install my software on some weird platform like, say QNX. I'm not comfortable saying that step 1 for installing my (relatively small and simple) thing is: install the (very large and complex) Rust toolchain.
I want to be able to ship C source that will compile anywhere. Though I am comfortable needing two separate C sources: a 32-bit source and a 64-bit source.
(I personally wonder if the MIR work mentioned elsewhere in this thread would allow for creating a simple compile-to-C backend without too much effort.)
The compile-to-C case is the most straightforward of the three you mention, but also the one I'm most skeptical of. I do understand that there are some venerable old and/or small platforms where C is the only option. I don't know any specific examples of what people want to do by transpiling to C though. The only thing I know with any certainty is '8-bit microcontrollers', and this is one case that Rust is likely to be a tough fit for (largely because it wants pointer-sized things to be 'big enough', as well as other reasons I've forgotten).
Still, if it's necessary, it can be done with great effort (see the perennially broken LLVM C backend), but it's very low priority as of now.
I'm not sure yet the role of a JVM/.NET backend for Rust (besides the coolness factor) and I don't think people have put a great deal of thought into it. What we will have though is easy ways to bridge between the managed runtimes and Rust for accelerating your managed code or binding to system APIs. This will be necessary for creating decent Android/Windows environments.
(On the .NET topic a MSIL backend would also get us non-asm.js JS via [JSIL](http://www.jsil.org/) which would give Rust access to the DOM. This is quite a flight of fancy though).
That is what most people want it for anyways.
If C is the output of the compiler, then we speak of a C Backend, which means the part that transform the final IR in the other language we want to translate to (eg: x86, arm6, sparc, ... C :)
As a final note, it's likely that platforms so conservatives that they only provide a C ansi compiler, will not be aroused by Rust.
And the fact that the program isn't tied to a specific runtime also would make it more compatible with other runtimes. You can't really run a JVM program on .NET, because the JVM and .NET have two totally separate universes of assumptions the runtime makes. When the program is runtime-agnostic, it can more easily be retargeted to different runtimes.
In general though, remember what a young language Rust is (May wasn't that long ago!) and understand that large and notable projects take time to appear. Docker didn't appear until Go 1.0 was one year old, for example.
Programming languages never die, so I don't have a personal opinion on this point, exactly. For me, I would only write C code if I was working on a C project, or if I couldn't get a Rust compiler for the target platform. My starting point would be Rust, it would have to be disqualified for me to use C. Then again, I am the most biased person possible... (and also prefer C to C++) But regardless, C will never, ever die, so talk of Rust 'killing' or 'replacing' C is misguided, in my opinion.
(Queue person who started a COBOL project last week..)
In that sense, I think Rust has a real shot at at least severely wounding C++ or at least opening the door for the real C++ killer (it might be that Rust is a smidgen too strict in the mut ref department to really kill C++, I'm encountering a lot of push back from experienced C++ devs). We're talking about a 15 year timescale though, so that's at least 3 era's of computing.
Experienced X devs pushing back against Y doesn't mean that Y isn't going to displace X; the big factor in displacement isn't whether experienced devs will voluntarily shift (even if Y does displace X, the experienced X devs have the most vested interest, and will be among the last to voluntarily move to Y.)
> I'm encountering a lot of push back from experienced C++ devs
Yeah, this bit is really interesting. It seems fairly split, though I'm not sure in what ratio. Some C++ devs are really into it, but others are very opposed. When you're used to total freedom, but then the compiler yells at you, there can be frustration...We've also seen a _tremendous_ amount of interest from people who don't strongly identify as a 'systems programmer' at present. RustCamp was last weekend, and the audience is very broad. It's a classic "growing the pie" situation: Rust may or may not take away some of C++'s audience, but it very well just might make the pool of systems programmers significantly larger. We'll see!
Can't underline this enough, as a long time WebDev with a lot of JavaScript, Python and Lua experience, Rust really feels like a door opener into the bare metal* world.
Especially as a Node Dev I felt right at home with Cargo. And as someone who only rarely touches C/C++, having the compiler scream at me for the first 10 days or so was probably the best "tutorial" about memory management and ownership I've ever "read" :) Rust really made me think a lot deeper about who / where and when stuff will be owned and eventually destroyed.
Overall, the language, cargo and everything around them fit so well together, learning it has been a real joy so far :)
* Well I've also done Z80 assembler on GameBoy before but that's probably not what people today would consider "bare metal" these days.
I wouldn't say never, of course. I'm looking forward to using Rust. Just not now.
Reading Java code that uses undercore_separated_method_names or C# code that uses camedCased immediately makes me think the author doesn't know what s/he's doing.
Though this has pretty much definitively made C++ too large for any single person, and there are some fundamental semantics that ensure Rust will always have the high ground in some areas, the lines related to functionality are getting blurrier.
There have been literally thousands of programming languages over the years ( https://en.wikipedia.org/wiki/List_of_programming_languages ) and I can't imagine that more than a handful (which most people itt can name) have survived from the 50s, 60s, and 70s.
My "mojikun" brainfuck variant is certainly dead, but then again, it was never really 'alive' either.
If you're using C for something, then probably not, for the same reasons you are not using C++.
On the other hand, once you do convince the compiler, you have an excellent chance that the code actually is correct, and you'll spend far less time chasing down crazy runtime bugs.
That's what I love about Haskell as well. Know of any other languages like this?
In general, I'm a big fan of static typing. I don't know any other language that manages to provide as much static memory safety as Rust, though; that's the main innovation in Rust.
And yet strictness typing seems to be on nobody's plan for future Haskell extensions.
TBH, Rust looks a bit stillborn - too weird to live, too rare to die.
In fact, I don't see how Go is C like at all. It seems much more akin to other managed languages, like Java. The only reason it seems to come up in these discussions is that Google said it was for "systems" programming, using a new value of "systems".
Maybe you're referring to mindsets and syntax or something?
I also happen to prefer Go's syntax to Rust's, but I can live with GC'd performance. If I were writing something as performance critical as a browser rendering engine, I could get past the weird syntax. I think both Go and Rust have bright futures.
I disagree with "too weird to live" but at least it makes sense. What does "too rare to die" mean?
OTOH, Rust is maturing quite well, and I think it has broader applicability and a very different area that is its strongest point that is the case for Go, so I think that its quite likely to do well initially in places where Go isn't much of a competitor, and in the long run may well be more successful than Go. (Particularly, its focus seems to be aimed at lower-level system programming than Go's, but a the same time it has constructs that, once good low-level libraries are in place, seem to make it potentially quite good for higher-level programming as well.)
I don't use C++, because for every thing that can be written in C++ there's always a more complex/clever version that should have been written instead.
Watching the language evolve has been interesting for me. Its an interesting language for a variety of reasons. Those that did a lot of c/c++ programing are probably the biggest fans.
This post wasn't the greatest, but good to see where things are going/ improvements being made.
I think Rust strikes a chord with a lot of people, even those with no investment in it.
Well, how about 300+ points and 109 comments, as of now?
1.2 is not a "minor Rust release" as it brings quite a few changes. Besides, we get the same posts for Go releases and tons of other projects besides.
If you don't like them, skip them.