202 points · by myth_drannon · 7y ago · 154 comments
After a lot of languages that are just rehashes of what we’ve already seen, or just a different subset of features, Rust is a languages that actually feels like it’s from the future that's finally going to start moving us forward after a lot of stagnation in industry while PL theory has continued to move forward.
If you haven’t given Rust a shot yet now is the time. You can get rust up into the top ten. :}
At the end the day it's platforms that move languages, not posting on HN and reddit.
They quite brutally damned Rust with faint praise in the article: "It’s also worth noting that even if Rust never gets much beyond where it is today, it’s still ranking higher than well known languages such as the aforementioned Clojure and Groovy, as well as CoffeeScript, Dart or Visual Basic. Not bad for a systems language."
Ranking higher than VB...
MS basically killed it, in 200x when the VB.NET snafu happened. I assume 100% of the VB work is legacy at this point and since solid architecture or design principles were never this language's strong points, it can't be particularly exciting legacy work either.
It's basically a career and technological dead-end.
On Windows C++ was the tool of choice and Delphi was kind of a secret weapon for GUI development. Then C# happened, and MS unceremoniously flushed VB down the drain. The VB community was outraged about VB.NET...
So, I'm curious: how does HN see this situation going forward? Where will Rust find widespread industry adoption, and what can Rust community do to bring this forward?
Rust can best grow its developer base by growing the number of new systems programmers, as they would have less to lose by using Rust and would be less likely to notice its limitations. The challenge here is that becoming a competent systems programmer is much more difficult than learning a new programming language, and there is a chronic shortage of developers interested in systems programming.
If we were still using classic C++ (i.e. C++03 and earlier) then I think Rust would have a real chance. The rapid evolution and adoption of modern C++ has fixed many (most?) of its major weaknesses.
Modern C++ is not memory safe, and there is no way for it to achieve memory safety without either significant runtime overhead or breaking compatibility so much it won't be C++ anymore. The features in modern C++ are nice, but they don't solve my problems.
Some bigger companies are supposedly using Rust (Amazon, Google, MS) on some projects, but these companies have so many things going that they are likely to use most languages in some kind of project. I've also heard that there are several "invisible" Rust jobs, only available through connections - but these are irrelevant IMO. And then there are the jobs where one is obviously not using Rust, but they mention it to score points or dangle it as a possibility.
Until I see a strong market for Rust skills, or my own employer offers interesting Rust projects, it doesn't make sense for me to invest beyond learning the basics. Funnily enough I'm looking into Go now - its job market is one-sided and quite anaemic, but it offers some nice technical benefits and is a piece of cake to learn.
Having said that, I don't think the rust ecosystem is going to go up in flames anytime soon, but lack of professional application at the moment doesn't bother me too much.
Most mainstream languages being used today took around 20+ years to get here, Rust will need as much for long term survival.
It did? Can you link me to the new stuff?
Prolog seems like a good example. It is used in AI classes and "different enough" to leave students with lots of questions for assignments (imo). At the same time it's not used in many industry projects and if it is companies tend to use proprietary Prologs (like Sicstus) and the code is unlikely to be on Github.
I suppose one could also argue that good setup/tooling and documentation helps to push a language below the line. I'd say Elixir is a good example of this.
So by and large I'd lean towards languages below the line when trying something new. Am I wrong? Alas the next language I want to play around with (F#) is above the line. But the domain modeling with F# talk/website is very intriguing.
Kotlin is doing really well for its age especially, I'm guessing mostly used by Android devs (so far).
1. IMO Rust has the closest thing in "imperative" languages to haskell's type system in a recently released "mainstream" language.
2. Rust brings an entirely new value (memory safety), and accordingly an entirely new hurdle called the borrow checker. This feature is so advanced that languages like Haskell are catching up (it's not a competition really) by introducing things like Linear Types[0]. That's really impressive.
3. Rust is targeting system programmers -- they move the slowest (as they should) in the ecosystem and are the most risk averse (as they should be).
4. Compare Rust to relatively recent systems-level languages (I won't name any), it's doing great.
5. Staying at the same place in the rankings is actually moving forward -- it may not seem like it, but it's hard to stay both effective, liked, and relevant in the world of programming languages (see: Dart).
I don't think rust is the kind of language to just shoot up the rankings -- it contains both higher level techniques that aren't quite mainstream yet and is targeted at a smaller community (though they're kind of going after web people with the wasm stuff).
I think rust is the kind of language that shows up to be consistently near the top of the rankings in 10 years (and I've said it numerous times but I think Go will displace Java and Rust will displace C/C++ where possible).
Yes, I will concede to a slight bias in favor of rust :).
Julia? Nim? That's about all that comes to mind.
I wish I could read the Haskell documentation, but the code examples are straight up black magic to me. I really need to dig into some proper functional programming at some point!
Just get the basics down and write some stuff. For a lot of things, you don't need to know how they work underneath in order to use them. It is helpful to implement functors, applicatives and monads for some of the basic data structures to get a feel for things, but then beyond that, just use what has been provided. Don't try to write your own monad transformers, just use the mtl library. Lenses are really complicated to understand, but really simple to use. The servant web library uses some high end type level stuff in order to work, but it is really easy to use. The compiler has your back.
If something just doesn't work and doesn't make sense, just move on and find a different way. After a while you will understand more and can return to it.
Don't try to understand the academic papers that have been written with Haskell. There is a really tradition of making the Haskell code as incomprehensible as possible. It will just get you down.
Haskell definitely has a high early threshold that you need to get over. After that it's pretty much just fun and smooth sailing until you try to do something bigger, at which point there's another threshold.
The learning experience is the most fun I have had programming.
As absolutely suitable for self study I would recommend:
https://www.amazon.com/Elements-ML-Programming-ML97-2nd/dp/0...
The term "systems language" is almost certainly not precise enough. What I mean to convey was a language that you could write performance critical low level code in. In my mind though, Rust satisfies both that definition and the vaguer "backend service" (i.e. the thing spinning behind some interface doing the hard work in your architecture) -- it works very well from very low level all the way up to application programming.
If we're taking the second definition (vague backend-service-y) then Rust has lots more good competition -- if you can afford a runtime then the right language can give you some pretty good safety for less than the cost of learning Rust's borrow checker.
BTW I hear you on the haskell docs, how to start with Haskell is one of the hardest things. I personally took this path:
- http://learnyouahaskell.com (a fun read, introduction to basics, good prose)
- Writing some euler solutions (quickly stopping, they become just a mathematics fest after a while)
- http://book.realworldhaskell.org/ (excellent examples for real-world code)
- http://adit.io/posts/2013-04-17-functors,_applicatives,_and_... (when you feel like you really want to understand the big M)
- Writing the backend for a project in haskell
- Watching lots and lots of talks and attempting to read papers to just headbutt certain concepts over and over till I could somewhat begin to understand them.
I've found the secret is just to let the stuff go over your head at least 2-3 times until you start finding it useful.
But I want to stress that you don't have to write 5th order polymorphic dependently-typed whatever to get lots of value from haskell, here is some low hanging fruit:
- Haskell has the type system you thought/wish Java/C# had (i.e. `type AorB = A | B`, `newtype PositiveNumber = N { _posNum :: Int } -- guaranteed through constructor to be >= 0`). The ease with which you can have types express intent is mentally revolutionary.
- Behavior and object structure are separate, like Go's structs + interfaces or Rust's structs + Traits, and constraints (dependencies from one typeclass to another) are really easy to use -- ex. `class Thing a => BigThing a where { ... }` expresses the dependency that for a to be a `BigThing` it needs to first fulfill the requirements of being a `Thing` -- this is how you can force the existence of certain functionality on with polymorphism. Once you get used to this everything else (well, subtyping at the very least) will look primitive.
- Concurrent programming is amazing, both due to STM and the very good threading model (lightweight routines multiplexed to system threads)
- I will say that I think there's lots of low hanging fruit out there though -- Haskell has the type system you thought Java/C# would have. They really have "class" systems rather than type systems.
it could also compete with go and python for command line tools but I think the mental overhead of the syntax makes it hard. i would rather write rust then go or python though.
Rust also feel like a very work in progress language, especially with useful features only in nightly often.
The rust community seems to be slowly but steadily working through a bunch of bigger use cases (all in the open as well, so you can see exactly what they're doing and why). For networking use cases, see projects like tokio[0] and hyper[1] to see how the community is moving (here's an awesome talk on it[2]). To me, it looks like the rust community is actually trying really hard to build things modularly and slowly from the start, taking tons of time to "measure twice cut once".
All that said, building networked systems in Rust is definitely extremely usable right now (and in many cases without nightly, I don't turn it on for any of my projects) -- maybe you won't find a gopher-server crate (rust's packaging mechanism) but for regular HTTP/HTTP2 you're going to find a lot of production-ready software (rocket[3], actix-web[4], tower-web[5]). I'd love to be pointed to some recent post where someone spelled out their issues writing some basic HTTP/HTTPS REST-ish backend servers (which I think is what the majority of people are writing/maintaining in their day jobs).
Side note (I'd love for someone to correct me), but generally when people want "performant" multithreaded network services, I take that to mean they want the combination of all system cores utilized and IO treated asynchronously -- in my mind this is basically all it takes, everything else is application/solution-space level optimization (parse your JSON a little quicker, maybe use a better data structure, do more things concurrently, etc). Rust has both of these things (system threads, libraries with async support) -- for example async/await syntax is landing soon, and from what I know the state of the art has progressed in this manner: callbacks->deferred/promises/futures->async/await -- rust is already 2/3 and async/await support is landing soon. And on top of all this -- rust is going to make parallelism & concurrency safer -- this is huge because while it might have been easy to `#include <pthread>` in C/C++, it sure isn't/wasn't easy to write correct concurrent/parallel code without the support of a runtime.
[0]: https://tokio.rs/
[1]: https://hyper.rs/
[2]: https://www.youtube.com/watch?v=4QZ0-vIIFug
[3]: https://rocket.rs/
[4]: https://actix.rs/
Java certainly isn't perfect today and it certainly wasn't perfect when it gained the mindshare it has now. I think it's pretty impressive that Golang has achieved anywhere-near-JVM speed with easier concurrency primitives and ease-of-use in the time it has. What standard are we holding Go to that Java would have fit at the time?
If you meant Ecosystem-wise there are very few ecosystems that can compare to Java, since it's been around so long and has been the workhorse of (I think) the majority people being paid to write code for so long. If this was the way we picked languages, no new languages would ever emerge.
People are being productive in Go, and they're using it to write lots and lots of software. It's a good tool and is already production worthy, at the very least based on the fact that it's already running in production in many places and hasn't spectacularly failed anyone yet.
somewhat related rant
Also, I think Go changed it's official logo (from the gopher) in an attempt to fit this kind of language, and I think it's stupid. Who cares if their logo is of a worm -- if it's a good piece of software, then the right people (who value good software and craftsmanship over some appearance/facade of professionalism) will use it. People pay us to write good performant software, most of the time they wouldn't care if you wrote it in Brainfuck as long as it worked and worked well (of course, there's also the fact that someone has to maintain it, but let's pretend that doesn't exist).
end rant
I do think eventually it could replace C though -- because rust with `unsafe` blocks still has the possibility of being safer than C. This could be a boon to security critical software, as long as the performance margin isn't too hard. Shops that have found ways to write safe C will likely never move (they don't need to), but new ones might pick rust where they might have picked C otherwise.
BTW, the embedded support in rust is really impressive for such a young language: https://github.com/rust-embedded/awesome-embedded-rust
But Rust is so overwhelmingly better than C, Go, Java, and C# for things people use those for, it may have a bright future replacing them, once its libraries and tooling mature enough. It will be competing with C++ on that, but there's room for both.
I'm using https://github.com/BurntSushi/ripgrep which is rg, like ack or ag (TheSilverSearcher). I've been using it for a few months, and I like it just a little bit more than ag, because I find its help and interface a bit easier to use. Like ag, it's incredibly fast.
Just this week I started using https://github.com/watchexec/watchexec to run rsync to sync from my mac to my vagrant box, because I was switching from using neovim on vagrant to using Visual Studio Code. It works great and has a very nice command-line UI.
Another tool that's written in go that I thought maybe was written in rust that's handy is https://github.com/shenwei356/rush which runs multiple commands in parallel, like xargs. I'm using it to transfer images between folders on s3 using aws-cli.
Based on this, and Servo, which is unstoppable with its Doge logo, I think Rust is going to be a very widely used language. https://github.com/servo
Edit: I remember part of why I liked rg more than ag - I got to use cargo rather than go, which is a much more intuitive and less opinionated way of downloading libraries than using the go cli. go is coming around though: https://blog.golang.org/modules2019
C and C++ have been stable for years, and so has all the little UNIX tooling that was built using them. People are excited by Rust, and take it upon themselves to re-build these tools, as they have well defined requirements and characteristics.
The reason these tools might be better is because thought has gone in to modernising and enhancing existing features. That might not be so feasible/ easily doable if you were juggling a decades old codebase to start off with.
I'm not sure what my point is, entirely... But ripgrep is good! I have replaced awk and grep with it, because it just feels more... user friendly?
EDIT: remembered my point. Are you switching to Rust tools because they are written in rust/ benefit from Rust in some unique way, or because it's a common platform people are re-implementing and re-imagining classic UNIX tools in?
I think it's a little bit of both for me.
The Rust tools tend to have a nicer UX (pretty-printing, colouring by default, with smart detection whether output is to a terminal, subcommand-oriented CLI a la git, etc). This is probably a consequence of nice library defaults but also a matter of culture. They also tend to be very fast. Again, Rust is inherently inducive to writing fast tools, but you also have to do things the right way.
Perl? Please, Perl was SO huge that I'm surprised it's as low as it is (which makes me suspect the methodology, actually ...).
In addition, if I remember from the TIOBE index there is the "Top Ten" and "everything else" where 10-20 is basically 1%+some noise and 20-50 is like .3%+noise.
> Kotlin is doing really well for its age especially, I'm guessing mostly used by Android devs (so far).
I wish the Android ecosystem would finally pick something and just stick with it. Having tooling, samples, and documentation that don't go out of date every 6 months outweighs any mythical "advantage" that switching language, build system, etc. actually gains.
This is exactly why I didn't stick with Android for too long. Everything's too... in flux, but in a weird way.
"YAY, Google released this feature I've been dying for! Can't wait to use it in 4 years, when enough phones actually support it :)". It's either that or have API level dependent code.
Maybe Dart will fix some of these pains, by abandoning all they have built up? It is Google, so I'd say it's unlikely, but still.
Hell, I was trying to build an analog clock widget as a tribute to a certain sports team, and Google had deprecated the AnalogClock class. Its successor was, well, nothing. So a few community efforts took its place, and the fragmentation only got worse. Thanks, but no thanks!
The only good part about Kotlin getting entrenched is that JetBrains is MASSIVELY invested in not letting Google switch to something else--so we may finally get some stability for a change.
I think that's what we're seeing here but the graph isn't really making that clear. I doubt Pascal is used nearly 50% as much as java (unfortunately) for instance, it's a logarithmic scale.
For Kotlin that is Android. I am more interested to see what will happen to it if Google has one of their usual project reboots with Android.
Rust still fails short in several domains, but now with Google and Microsoft's additional love we might see some improvements there.
I now use Kotlin on Android, and it’s mostly a tidied-up Java that’s slightly better in every way. The one big difference is checked exceptions -- Kotlin doesn’t have them.
My question is, do Kotlin users prefer unchecked exceptions, or do you find yourself avoiding exceptions entirely now? Or even dropping back to Java when you need exceptions and you want compile-time checks?
I find myself mostly trying to avoid exceptions entirely in Kotlin -- maybe not such a bad thing!
I can't speak for Kotlin users en masse, but personally I don't miss checked exceptions one bit, same as I didn't miss them in C#. And I've never encountered the practice of "dropping back to Java" for checked exceptions of all the reasons.
A compelling way of emulating the presumed benefits - without the bad parts - in Kotlin would be to go sort of functional and use a Try return type from Arrow-Kt: https://arrow-kt.io/docs/arrow/core/try/
I was trying to figure out if people are happily using unchecked exceptions, or not using them at all.
I generally find that I avoid exceptions, but where they are necessary I try and catch at the right level to handle them.
[1] https://trends.google.com/trends/explore?date=today%205-y&q=...
Right.
I think it's a bit of a stretch to call java.com "the website for Java". I end up on python.org (or at least docs.python.org) often enough. I never go to java.com. If I end up anywhere on the "official" Java websites, it'd rather be docs.oracle.com/javase/...some-doc...
I’m curious to see just how much of it is due to client side, as it probably skewed the ranking due to the fact all websites use JavaScript.
I want to just see how node competes with other backend languages like php ruby and python
I'm learning Swift at the moment and I'm running out of eyebrows, due to the sheer quantity of unforced facepalms I give myself.
As an example, I had to write a little code to connect some Swift and Obj-C code the other day. (I don’t use either one regularly.) It was very hard to find good up-to-date docs on how Swift/Obj-C bridging works.
I tried to create a simple tool to retrieve a JSON reply from an API and display the results. Piece of cake, right?
Took me a day of debugging and hitting my head on several objects before I figured out that none of the half dozen tutorials I found were made for Swift 4.x.
I’ve got about 30 iOS examples on Github:
Wouldn't that imply that C programmers resort to SO more often than they publish code on GH compared to JS?
C has two big areas I think - Linux/open source software, and embedded work. A lot of open source projects in Linux land are for whatever reason not in Github. Heck I still see sourceforge a lot. Embedded work is likely done for a company and of course wouldn't be in Github.
both GH and SO are probably not representative of the industry.
With Go especially, my default move when I have a question, is to go to golang.org/pkg and find find the package I'm having issues with. Assuming it's a standard package problem, of course. The built in editor for examples is really great. I can run a little test quickly, and move on.
Could have been the interaction with the framework and the fact that it lagged behind on Angular/TS at that time.
Even Fucshia is now adding support for other UI frameworks via Scenic.
Do you have any criticism about flutter you’d like to share ?
Less mature than every cross-platform mobile UI framework that are around since iOS and Android have won the mobile market.
At the same time Fuchsia how has a UI composition engine, where Flutter is just one option among many (Scenic) and they are toying with a Rust based one (Fuchsia-ui).
Being burned by Dart 1.0, I will only take it seriously when it officially gets adopted by the Android team.
But programming languages are different: programming languages are not just technology, but what programmers think in.
They're half technology and half religion.”
— Paul Graham
The "Popularity Rank on GitHub" is probably more accurately measuring popularity in the popular sense of the word. That's especially true because the GitHub archive used for the data only offers info on public repositories and even then I'm curious to know how it reports for multi-lingual repos (does LOC win out, do repos get associated with multiple languages?).
Personally 90% of my commits over the past year have been to private repos for work. My public commits are in languages I look forward to using and learning outside my 9 to 5 because they interest and they offer a nice change up (ie PureScript and Rust lately).
I'm super stoked to see FORTRAN is riding solidly at 60% for both metrics, regardless of what those metrics truly measure. ~40 public commits in the last 24 hours! Check it out:
https://github.com/search?o=desc&p=4&q=fortran&s=updated&typ...
Off Topic PostThought:
Seeing JavaScript at that top corner and the amazing
surge over the past couple years of Rust has got me
thinking that when it comes to the art of programming
languages, Brendan Eich is a (if not the) seminal
artist of this time period.
Learning JavaScript is when what Dostoevsky,
Kierkegaard, Sartre and Camus were all trying to
communicate really hit home for me. Meanwhile a recent
foray into Rust is reminding me of the first time I
read books like Tolstoy's Anna Karenina, Borge's
Labyrinths and Steinbeck's East of Eden.
To me it's pretty amazing that the same person has
played pivotal roles in two languages that are both a
joy to write and reason with and for completely
different reasons.Any time you are trying to solve a problem in a domain you are unfamiliar with, you have two problems. One is understanding the problem, two is understanding the framework's bizarre way of solving it. Java mitigates this in that most of the libraries and frameworks seem "familiar" and do things in a similar way.
I do see a lot of programmers that seem to eschew the ecosystems available to them and prefer to write all the code themselves. In that case, maybe Java is not compelling.
For new OSS or hobby/pet projects I can also not come up with a single reason to use Java, except "I don't know anything else and don't want to invest time learning"
I was pleasantly surprised at the popularity of Haskell.