Hacker News new | past | comments | ask | show | jobs | submit login
The Rust compiler has gotten faster again (nnethercote.github.io)
200 points by JoshTriplett on Nov 12, 2021 | hide | past | favorite | 134 comments



I really like Rust, it hits a lot of sweet spots for me – strongly typed, neat type system, the mild functional-ness thats useful while keeping people from going too crazy with functional patterns, usually low on boilerplate, static binaries, clever little things like ? ... but sometimes I wish there was a garbage-collected version of it, the constraints of the borrow checker make things like tree structures at least an order of magnitude harder to get right, and I'd love to have the ergonomics of the language and the ergonomics of a gc-ed runtime. Not going to happen I guess, but I feel like there's an opportunity for a Rust-ish language that is somewhat less finnicky, at the cost of making some abstractions more expensive, for microservices with complex business logic and such.


I actually support the idea of adopting Rust's ideas in a memory-safe, garbage collected language. I like garbage collection—it's not always the right tool, but it's a great tool in the proper domains. Modern GC builds upon decades of research to achieve memory safety at runtime with good performance and very low cognitive overhead on the part of the programmer.

What I don't agree with is the idea of taking Rust's ideas and putting them into manually-memory-managed, unsafe languages. We should be moving away from such languages as an industry.


> I actually support the idea of adopting Rust's ideas in a memory-safe, garbage collected language

You're describing Swift


Swift also has some stuff coming from the history of Objective-C interop (inheritance is the big one I'm thinking of, although I'm sure there are others that are slipping my mind). I'm not sure how mainstream this opinion is, but personally I _prefer_ not having classes and inheritance, and while I could always choose not to use them in my own code, I imagine it's common enough in libraries that I'd end up dealing with it a bit anyways. Combined with the fact that Linux support still seems like it's a bit secondary makes me feel like there still is a potential niche out there for "Rust with garbage collecting" that Swift might not be filling entirely.


Yeah I agree, I think one of the biggest mistakes in Swift was coupling reference types to classes. Choosing whether something is a reference type of value type should have been orthogonal to the class system, if they included classes at all.

But in practice I think modern swift uses inheritance very sparingly, and leans much harder on the protocol/extensions system, which is very well design imo


What are you both talking about? Swift doesn't have garbage collector the same way Rust doesn't have it.


Swift doesn't have tracing GC, but to be pedantic automatic reference counting is a form of GC.

But that only goes for reference types. For value types you're correct that both languages use mostly static memory management.

I guess in that sense you'd have to consider Rust as a gc'd language as well: the only difference really is that you have more fine-grained control over which mode of reference counting is being used for a given object.


See also "A Unified Theory of Garbage Collection", https://researcher.watson.ibm.com/researcher/files/us-bacon/...

> We present a formulation of the two algorithms that shows that they are in fact duals of each other. .... Using this framework, we show that all high-performance collectors (for example, deferred reference counting and generational collection) are in fact hybrids of tracing and reference counting.

...

> For every operation performed by the tracing collector, there is a corresponding "anti-operation" performed by the reference counting collector.

...

> We have shown that tracing and reference counting garbage collection, which were previously thought to be very different, in fact share the exact same structure and can be viewed as duals of each other.


Chapter 5 of the GC Handbook, one of the major CS references in GC algorithms.


GC is standalone runtime that does tracing and deallocates memory at some arbitrary time. Are you really claiming that using C++'s smart pointers is using GC? I think you're conflating semi/automatic memory management with GC.


You're conflating tracing GC algorithm with GC as CS concept.

Regarding C++ smart pointers, if you manually call them like in std::shared_ptr<>(), no.

If the runtime calls it for you like on C++/CX or compiler blessed types like _com_ptr_t, then surely.


ARC in Swift doesn't have runtime part, retain/release code is injected at the compile time. It doesn't have ie. cycle detector running periodically or anything like that. If you define this setup as GC then by this definition Rust's borrow-checker is also a GC because it works the same way - by injecting static code during compilation (but has different rules).


Swift does not employ garbage collection, but reference counting.


Chapter 5 of the GC Handbook, one of the major CS references in GC algorithms.

Reference counting is a GC algorithm, regardless how people sell it to the man on the street.

Additionally there is a whole set of politics how ARC had to be sold after the technical failure to make Objective-C GC implementation work without core dumps, due to the underlying C semantics.

Plus making retain/release calls automatic wasn't anything new as idea, VB and Delphi did it first with COM AddRef/Release.


Swift doesn't have tracing gc but ref counting is a form of gc


Also Haskell, D, Chapel, among others.


> I actually support the idea of adopting Rust's ideas in a memory-safe, garbage collected language.

sooo... ocaml?


Or many other programming languages, but yes, OCaml is a pretty good one, and it is perfectly suitable for systems programming.


I can attest that so far the lifetime static analysers for C++ haven't progressed that much.

However until certain C++ overloads don't give more love to memory-safe, garbage collected language or languages like Rust, that is better than nothing.

For example, I don't expect Windows team to ever lose their love for C++, NVidia moving from their C++ love for CUDA, or Metal shaders in something else.

Ah, and then many of those languages are keeping C++ around by building on top of GCC or LLVM.

So any improvement towards to make C and C++ safer is better than just using them as they are.


For what is worth, you can opt-into reference counting and internal mutability with container types (Arc/Rc, Cell/RefCell, RwLock/Mutex), and get the same performance characteristics as a GC language (but without a JIT) for the cost of more complex types in your signatures.

Edit:

> the constraints of the borrow checker make things like tree structures at least an order of magnitude harder to get right

The constraints of the borrow checker make those things more unlikely to compile without extra ceremony. The likelihood of getting them right is orthogonal from making the compiler "happy", even in Rust but specially in other languages. The way I've heard it described is that Rust is a language where you get the hangover first. It upfronts dealing with the error conditions of your problem space in a way that (you can argue) hinders the exploration phase, but that makes of a very quiet maintenance phase.


People like to bring up reference cycles a lot as if it's always a deal-breaker, but for short-lived processes it kind of seems like a non-issue. Anecdotally, we've seen Instagram get overall gains by disabling GC in Python (which will still do reference counted cleanup).


Exactly, I like implementing compilers and I personally never bother with anything other than reference counting nowadays. Ref count gives a very easy to reason semantics. So I count as a feature in my language even if it's slower than GC. Moreover, some of the "memory leak" discussions nowadays miss the biggest issue behind memory leak, which is resource allocation. Some people measure memory leak as the # bytes that process didn't deallocate at the time of exit.


> and get the same performance characteristics as a GC language

Pretty sure modern state of the art GCs, like the ones found in Java or .NET runtimes, are way more efficient than reference counting.

Reference counters have that unfortunate RAM access pattern where the counter is frequently updated from multiple threads concurrently. On modern processors, this means concurrent access to a cache line by different CPU cores. These cache coherency protocols are pretty slow. On many CPUs, reading a cache line recently modified by another core costs 300-500 clock cycles, even more expensive than a cache miss and roundtrip to system RAM.


Python is experimenting with a novel approach where objects have two reference counts, one exclusively for the owning thread and another for all other threads, improving performance when most of the increments/decrements are done by the owning thread.

https://lwn.net/Articles/872869/


They are, specially when ARC marketing from Apple gets validated.

https://github.com/ixy-languages/ixy-languages



Sounds like you're looking for Nim!


The constraints of the borrow checker do not make tree structures harder to get right! They just force you to get it right!


I don't think Rust is low on boilerplate.

As an example, here is a video of David Pedersen creating a simple Tower service: https://www.youtube.com/watch?v=16sU1q8OeeI&t=945s

I found it intimidating how much you have to write to create a simple middleware.


There's some amount of boilerplate that is unavoidable, but, if you have the patience, `macro_rules!` type macros can help cut down on syntactical boilerplate in many cases.

Compared to C, and sometimes C++, there's generally less boilerplate in Rust. Compared to more traditional web languages, though, Rust will seem to have more boilerplate due to it's lower-level design.


You're describing Swift


It's a shame Swift isn't as usable outside Apple platforms


Totally agree - it's a nice language and I would love to be able to use it everywhere


They already exist, OCaml, Haskell, F#, Scala, Swift.


Totally agree, really wish for a language that has all rust features + GC. OCaml and F# come close enough but they are not as popular.


>> Not going to happen

I sure hope not. Borrow checker has little to do with memory allocation/deallocation. It's there so that you can't have unprotected mutable shared state.


Kudos to the Rust and LLVM teams for taking performance so seriously! I'm excited to see things get even faster once the new LLVM pass manager is enabled by default.


That improvement is already included in the newest nightly, so it is included in the linked benchmark. It will ship to stable in the 1.57.0 release:

https://github.com/rust-lang/rust/pull/88243

Rustc supports running with LLVM versions other than 13.0, which some distros enable, but the official builds of rustc all use LLVM 13.0, a pre-release version in 1.56.0, and the final in 1.57.0 onwards.


Anyone using Rust on ESP32? I'm 24 hours into trying and it's dredging up memories of old cross-compile toolchain problems, like trying to compile dependencies as x86 :). Either way, it's a fun project so far so I'm not complaining. Embedded seems like a great fit for Rust for ensuring correctness and speed.


If you haven't yet, check out Scott Mabin's blog. He's working on ESP32 & Rust: https://mabez.dev/blog/posts/esp-rust-18-10-2021/


LLVM (Rusts' backend) doesn't support the Xtensa instruction set, which makes this so complicated. The newer ESP32-C{3,6} instead use a RISC-V instruction set which is already supported by Rust, so its much easier to set up.

So far I managed to get basic serial coms working, but am waiting for some HAL so I can build a blinky LED.


No, I started using Nim on esp32's due to the Rust/llvm toolchain issue and found it quite nice. I wrapped much of the esp-idf in a project called Nesper. Though I keep an eye on Rust in the embedded world. Rust type system does seem to require a lot more work creating shared hardware api's.


I remember Pascal compiling crazy fast compared to C/C++. Partly because the language was designed to be easy to parse, but I assume part of the speed came at the cost of producing less optimal code.

But if most of your compiles are during development and debugging where optimization is less important, wouldn't it be nice to have super fast compilation during those stages? I don't know if any other compiled language comes close to Pascal in that regard.


https://en.wikipedia.org/wiki/Tiny_C_Compiler probably compiles as fast or faster than the Pascal you remember.

You can even use it as a backend for the Nim (https://nim-lang.org/ ) compiler for subsecond builds of a modern language with various choices for automatic memory management.


> I don't know if any other compiled language comes close to Pascal in that regard.

Go and D are pretty comparable.


A faster codegen backend for debug builds is in the works.

https://github.com/bjorn3/rustc_codegen_cranelift


Will it allow incorrect code like an interpreter? I edit one controller/view in Django, print something and let it crash. Then I fix it and (hopefully) correct the rest of the controllers.


All languages allow incorrect code that crashes. Perhaps you're referring to compiler-aided refactoring (make a change, compile, inspect the errors, correct, repeat), which yes, Rust is very good at, as are most statically-typed languages.


A big part was that pascal had a decent module system, while C only has includes. The same header files can be included from multiple places and have to be processed multiple times. IIRC the Plan9 C compiler had some restrictions (or maybe just conventions) to prevent this.

Also, Borland Pascal / Delphi compilers weren't terrible at optimizing. And they often produced smaller executables.


From my experience C is very fast to compile. Especially compared to C++, because of the metaprogramming and monomorphization stuff. In C you would use void*.

Dynamic dispatch is faster to compile than static dispatch, but runtime performance differs. You can do dynamic dispatch in Rust, I think it could enable faster/smaller builds but at the cost of worst runtime performance.

Tradeoffs, Yada Yada.


While I agree the common pattern is to use void*/dynamic dispatch, this is not necessary. E.g., https://github.com/glouw/ctl/ or https://github.com/c-blake/bst show a couple ways to have generic code statically specialized in regular old C. (Instantiation/specialization is just marginally less automatic/syntactically supported.)


On our C projects back in the 2000's, a full build took around one hour, composed of Apache, IIS ISAPI modules, our own mod_tcl fork, all the TCL database drivers for MS SQL Server, Sybase SQL Server, Informix, Oracle, and several other native modules.

Then we had to repeat it for HP-UX, Aix, Solaris, Windows NT/2000, in release and debug variants.

A release would be a day event, so fast to compile is relative.


Wow, this is super impressive. Great work rust team!


Nice to see the ongoing improvements, congratulations to everyone making it happen.


[flagged]


"Please don't post shallow dismissals, especially of other people's work. A good critical comment teaches us something."

https://news.ycombinator.com/newsguidelines.html


I think Rust is a bit beyond "catching on" already.


While I agree Rust has a steeper learning curve with its lifetime and borrow checker. Why do you surmise that Rust is too syntax heavy? The BNF of Rust doesn't seem anymore complicated than most of the popular languages.

The current trend of Rust seems to to suggest the opposite as well, with more large adopters.


Large adoption, but I don't think the borrow checker and lifetime are the source of its steep learning curve


Um, what? Are you joking? Mind elaborating?

Rust has gotten tremendous momentum behind it—which is great since it’s introducing a lot of useful, heretofore cutting-edge tech from research into a mainstream language. (Thinking affine types.) Tooling is excellent too.


Wait till you hear about this little language called C++ :-)


C++ is my bread and butter but I don't want my unborn kids to be raised in the world where C++ is not living at the margins. That's despite of all the awesome people putting their sweat and blood in supporting the little languages additional standards.


TBH, compiled general languages are doomed to be complicated, because they need more info during compile-time. The only exception is C (if you don't count stuffs like Lisp). IIRC, C grammar can be easily printed on a single sheet of letter paper.


C is absurdly complicated (just try to understand all the different arithmetic promotion rules that can apply to an expression like "a + b"), you just don't notice it because it doesn't use that complexity for anything except occasionally giving you undefined behaviour.


Unfortunately, the behavior of C’s grammar is incredibly complicated.


I'm not convinced this is true. A simple grammar can express a whole lot of information. I think complex grammar is desirable in some cases because a lot of ways we choose to make grammar more complex are ergonomic. Binary infix operators, various kinds of brackets and braces, ... it all is a bit more difficult to describe as a grammar, sometimes more difficult to learn, but also closer to natural ad-hoc ways that technical people would write things down to communicate them. Just see the typical ways of writing mathematics as an extreme example.


Any language can be compiled whether it's dynamically, weakly typed or not.

Look at Chicken Scheme as an example or my projects compiling Javascript or Python.

https://github.com/eatonphil/pyc

https://github.com/eatonphil/jsc


It's sarcasm! (I'm sure)


We need a programming language that doesn't have syntax


I know this is snark, but there’s an arguably good answer. That’d be Lisp, according to an essay by pg that I’m too lazy to dig up right now. (Probably “revenge of the nerds” or something.) You just write the language in the parse trees.


arguably FORTH has even less syntax


Brainfuck and Piet come to mind... come to think of it, brainfuck compilers might get mad about unmatched brackets. You can't go wrong with Piet, though.


Tried perl? :)


If you compare it with Python, maybe. If you compare it with C++ or Scala, then not even close.


Scala syntax and boilerplate is a lot leaner than both C++ and Rust. Don't mistake weird operators in some hardcore FP libraries for "Scala syntax".


> Don't mistake weird operators in some hardcore FP libraries for "Scala syntax".

Fair, but Jesus every Scala library I look at seems to have its own DSL making the language seem unapproachable.


> I don't see it catching on

But it is! People are (re)writing stuff in Rust and sound very excited about it.


this comment was a great reminder of the level of discourse I should expect on the internet..

what the OP meant was “I don’t see myself using it”, but they instead projected their limited world view as prophetic.

hate to break it, but if we’re entertaining Rust in the Linux kernel, I’m afraid it has already “caught on”


What’s so “heavy” about it?


Is that you, Ken M?


[flagged]


I do Rust (and C, and C++, and Python) programming professionally, at a company that isn't famous for Rust engineering. I'm happy to answer questions about my supposedly nonexistent job :-)

On the more famous side: Amazon, Cloudflare, and Microsoft all have teams writing in Rust. I'm sure there are plenty of HNers from each who can talk about that work, sensitivity permitting.


Add Docker and Google to that.


* Dropbox, I meant to say dropbox.


I work with Rust as well but be realistic. There is very few jobs for this language compared to others.

I don't think your comment adds anything other than a "I work with Rust :-)" humblebrag


I'm proud of the work I do. But the language itself wasn't intended to be a humblebrag.

As far as "very few jobs" goes: sure, it's less than other languages. That comes with any new technology. But it varies heavily by discipline. The work my company does (program analysis and cryptographic research) already has a thriving Rust ecosystem, and demand for engineers is currently above demand for Rust jobs. My understanding is that things are similar in the network engineering space, at least at the larger companies.


there are virtually no jobs for it. You have a bigger chance of finding a job as a COBOL developer.


I don't know what to tell you: we hired quite a few people this year to do Rust (both programming in it and auditing Rust codebases). And we're a small company.

I assume that it will continue to be easy to find a job as a COBOL programmer for a very, very long time. But what kind of metric is that?


COBOL has an excellent job market. You picked a strange point of comparison.


This is trolling, surely. If so, mission accomplished.

Every one of the MAGMA tech companies (Microsoft, Apple, Google, Meta, Amazon) is adopting Rust in significant ways. That is extraordinary; and those companies are only the tip of the iceberg, and what is publicly known lags reality by 6-12 months at least.

Rust won't ever be as widely used as Java or COBOL, but clearly it is already having a huge impact on how infrastructure is built.


I am not a rust fan, but `ever` is a long time, and if operating systems are re-written in rust (which is preferable by far than writing them in C), that is going to be a lot of very widely used code.


> MAGMA

why does Facebook become Meta but Google hasn't become Alphabet?


The collective has decided that MAAMA is a worse acronym, and I agree.

The reason that Netflix has been booted is because (a) it's not really a tech company and (b) Microsoft's stock has started to grow a lot since Nadella became CEO.


Some typos in 'Facebook'.


Why would you back your argument related to jobs up with Tiobe which is not a measure of job listing commonality. Hell “assembly language” is listed above PHP in that list, and I can confidently say there are a lot more opportunities for PHP devs that for people working in some assembly.

Your off topic rant on an article simply discussing speed improvements on a compiler seems significantly more ideologically driven than most comments in here.


Heck, Visual Basic is rank higher than JavaScript is more than enough to understand the value of that Tiobe list.


Despite its bashing around here, plenty of MS shops do keep using VB, even for new projects.


As does everybody working at a slightly deeper level with Excel and that alone probably puts it near the top of PL usage.


As I worked on a couple of projects in life sciences, the migration path to VB was those users that wanted to grow beyond VBA so they would eventually adopt VB + WinForms for data processing, they didn't even care for R or Python, Excel and Tableau were they main tools.


Haha, even Fortran has seen serious growth in the last year apparently.


The hvasilev's comment got flagged and I could not reply to it anymore, so I'll reply here (sorry) and copy-paste the hvasilev's comment verbatim below, for the sake of commenting on it's claims:

---

Reality is not on the side of this language. 11 year old, has a very low adoption with virtually no jobs associated. (https://www.tiobe.com/tiobe-index/)

On the other hand if you search for "Rust" in the latest "Who wants to be hired?" thread, you will see it is quite popular with unemployed people.

The reality is that the language has a lot of friction, the ergonomics are bad, the syntax is heavy and some poor decision making has been made there for a systems-level programming language.

There are a lot of ideological traps in this industry and many people that fall for them. Why people are interested in ideologies and cults is beyond me.

[ A screenshot: https://imgur.com/a/tgAETjh ]

---

<rant>

Now my comments on the issues mentioned in the hvasilev's comment.

> Reality is not on the side of this language. 11 year old, has a very low adoption with virtually no jobs associated. (https://www.tiobe.com/tiobe-index/)

Tiobe index is shit. The most flattering thing I've read about it states that it (poorly) depicts quantity of educational materials available online for particular programming language. Unfortunate naming of programming languages after letters of alphabet, symbols (++, #) and real-life stuff (like islands) doesn't help this rating either.

That said, Rust isn't that popular and isn't growing much according to other better language ratings:

1. https://tjpalmer.github.io/languish/

A Github-based rating created by the author of Context Free YouTube channel. For 2021Q3, Rust is on 18th place with Mean Score of 0.82% (up 0.01% from 2021Q2).

2. https://madnight.github.io/githut/#/pull_requests/2021/3

A Github-based rating. For 2021Q3, Rust has 0.64% of Pull Requests, 0.30% of Pushes, 1.29% of Stars and 0.65% of Issues. Growth dynamic is quite flat.

3. https://redmonk.com/sogrady/2021/08/05/language-rankings-6-2...

Latest RedMonk language rating, dated June 2021. Rust is on 19th place with 0 growth.

---

About jobs comparison.

Indeed.com for California.

Rust: 527 jobs (with some unrelated stuff mixed in)

https://www.indeed.com/jobs?q=rust%20developer&l=California

JavaScript: 16,792 jobs (31.8x)

https://www.indeed.com/q-Javascript-l-California-jobs.html

Java: 12,418 jobs (23.5x)

https://www.indeed.com/q-Java-Developer-l-California-jobs.ht...

C++: 4,172 jobs (7.8x)

https://www.indeed.com/q-C++-Developer-l-California-jobs.htm...

Indeed.com for New York.

Rust: 85 jobs

https://www.indeed.com/jobs?q=rust%20developer&l=New%20York%...

Java: 4,815 jobs

https://www.indeed.com/jobs?q=java%20developer&l=New%20York%...

Javascript: 4,037 jobs

https://www.indeed.com/jobs?q=javascript%20developer&l=New%2...

C++: 1,126 jobs

https://www.indeed.com/jobs?q=C%2B%2B%20Developer&l=New%20Yo...

glassdoor.com without location set.

Rust: 492 jobs

https://www.glassdoor.com/Job/rust-developer-jobs-SRCH_KO0,1...

Java: 45005 jobs (91x)

https://www.glassdoor.com/Job/java-jobs-SRCH_KO0,4.htm

Javasript: 30952 jobs (62.9x)

https://www.glassdoor.com/Job/java-script-developer-jobs-SRC...

C (with unrelated stuff): 9594 jobs (19.5x)

https://www.glassdoor.com/Job/c-developer-jobs-SRCH_KO0,11.h...

Go(lang): 1406 jobs (2.85x)

https://www.glassdoor.com/Job/golang-developer-jobs-SRCH_KO0...

Judge for yourself if a few hundred jobs in places like CA and NY count as "virtually no jobs".

For comparison, in Ukraine (population 35-41 millions) there is 6 Rust jobs:

https://jobs.dou.ua/vacancies/?search=Rust

... 190 C++ jobs:

https://jobs.dou.ua/vacancies/?search=C%2B%2B

... and 676 Java jobs:

https://jobs.dou.ua/vacancies/?search=Java

... listed on the largest Ukrainian programming site.

---

> The reality is that the language has a lot of friction, the ergonomics are bad, the syntax is heavy and some poor decision making has been made there for a systems-level programming language.

Well, this is matter of taste, largely. But I have a few issues with Rust syntax too (IMHO):

1. F--king single quotes. Eww, really?! IIRC, a tilde (~) character was used for lifetimes until some Europeans (?) complained that their keyboards have no tilde. I wonder, how they programmed in C++ all that time? For years, if I met online a piece of code that was highlighted as a comments mishmash I knew exactly in what language it was. Ugly as f--k.

2. Closures using pipes (|). With no arguments they look like OR operator (||). Distracting.

3. Using angle brackets for generics.

4. Double colons (::) as "path qualifier" produce too much visual noise. Java likes long pathes too and uses dot (.) as separator just fine.

5. What with this arrows (->) before return types? Seems unnecessary. Couldn't return types be purely positional as in Go?

I don't use Rust so it's mostly "glimpses from the outside".

Speaking of friction. This reminded me of a video by Jonathan Blow (creator of Braid and The Witness games and Jai programming language). The video is worth watching whole but piece about friction in gamedev starts approximately at 49:23.

"Rant: Entity systems and the Rust borrow checker ... or something."

by Jonathan Blow

Sep 14, 2018

https://www.youtube.com/watch?v=4t1K66dMhWk&t=2962s

As for poor decision making, it was pretty poor decision to include an npm knock off into the language. I'm speaking of crates.io repository. For some time it has a squatting problem that isn't fixed yet:

https://old.reddit.com/r/rust/comments/9aaanw/cargo_crate_na...

3 year old thread, the squatter is still there holding 104 packages. At least npm has namespaces.

I wonder, if cargo will turn into malware-ridden micro-dependency hell too?

---

> There are a lot of ideological traps in this industry and many people that fall for them. Why people are interested in ideologies and cults is beyond me.

"MongoDB is web scale" video nicely illustrates "ideological traps" and cult-like behaviors in "this industry".

http://www.mongodb-is-web-scale.com/

https://www.youtube.com/watch?v=b2F-DItXtZs

And what else illustrates cult-like behaviors? Flagging an innocent comment you don't agree with. What was in the hvasilev's comment that warranted its removal? In my opinion, nothing. It contained no insults, no personal attacks, and was more or less factually correct. Rust is relatively unpopular, complex, ideological, syntactically-heavy language with relatively few job offerings, i.e. pretty much what the hvasilev's comment said.

Complaining about the comment being "off topic" is somewhat funny given Rusters' penchant for inserting their language into discussions about other programming languages (especially C, C++ and Go).

</rant>


> What with this arrows (->) before return types? Seems unnecessary. Couldn't return types be purely positional as in Go?

I guess you could say `->` is too verbose and you can omit it in other languages. Rust has a complex type system and there can be confusing code when you omit `->`.

1. Closure Return Types.

You can define a closure with an explicit return type:

``` let my_closure = |i: u32| -> u64 { i as u64 }; ```

Now how do you omit the arrow here? How do you know `u64` is the return type and not constructing a struct?

2. Parsing stuff

It becomes impossible to parse none-delimited types. Is `fn() fn()` two different types or a function pointer returning a function pointer?

3. Readability

I mean, tokens can be read out loud and omitting it stops making sense.

`fn foo(bar: i32) -> f32` can be read as a "function named 'foo' that takes an argument named bar with type i32 and returns f32". The word returns directly corresponds to the `->` token.

Rust also has the `!` (read: never) type. Poorly formatted code when `->` is omitted is very confusing: `fn a()!` when compared to `fn a()->!`, or just one character generic types: `fn a<T>()T` compared to `fn a<T>()->T`.


Thank you for clarification.

Seems like arrow (->) is the best choice for Rust, given arrow's visual distinctiveness and search-ability.


> Complaining about the comment being "off topic" is somewhat funny given Rusters' penchant for inserting their language into discussions about other programming languages (especially C, C++ and Go).

The childlike “well they do it too” argument is almost the perfect example of how the anti-rust crowd is becoming even more obnoxious than the infamous Rust evangelism strike squad.

For the record , I’ve never written a line of rust in my life and am not particularly invented in its success or failure. And no, I didn’t flag GP.


why do you think i'm backing my argument to jobs with Tiobe?

how is negating an ideology ideological?


You’re not negating anything but a strawman here. You commented too level on an article on someone simply talking about how a compiler whining about something unrelated to the article.

If you were responding to some rust fanatic or if the article was some sort of rewrite in rust call, you may have a point, but it’s nothing but some developer interested in improvements in the compiler. God forbid anyone work on anything other than some mainstream technology.

> why do you think i'm backing my argument to jobs with Tiobe?

You may not be, I assume because it immediately followed the statement about jobs in parentheses.


Try https://indeed.com or http://www.modulecounts.com instead of Tiobe which is one of the worst metrics. The Rust community's module output is well ahead of both Ruby and Go so I'd say it's fairly mainstream.


The Go measurement on that website is based on a discontinued package manager and seems to no longer be updating.


>11 year old

Rust 1.0 was in May 2015, it's only 6.5 years old, not 11 years.

The equivalent comparison would be where Go was in 2015, and I don't think Rust is doing poorly compared to that benchmark.

Anyway, Rust is seriously being considered for inclusion in the Linux kernel. I'd hardly call that a failed language.


Rust is 11 years old, Go is 12 years old.


Graydon Hoare began working on the language that would become Rust in 2006. Rob Pike began working on the language that would become Go in 1995. Neither of these are useful dates because the languages that were eventually produced were drastically different at their inception compared to where they eventually ended up.

For the purpose of maturity, the point in time by which to begin measuring the age of a language is the first point at which a stable release appears for general availability. Go is 9 years old, and Rust is 6.


I think it would behoove you to explain how you're coming up with that number, given that the person you're replying to has pointed out exactly when Rust 1.0 was released.

If we're going by design inception dates, Go goes back to 2007 or earlier.


public announcements.


This is a weird metric to use, given that Rust was incubated at an open source company (Mozilla) while Go was developed for years as part of a private project. Put another way: Rust's development was much more public than Go's was; why should that be held against it?


You're feeding a troll that's managed to derail the point/conversation with an incoherent offtopic comment... I really doubt they care what you or anyone has to say to them (which is evident from their replies). Their comments/replies give you just enough material to pull you in, and then they grapple you to their level. It doesn't even have to be intentional/conscious on their part, but they're definitely doing it.

Not necessarily the troll's motivation, but: there's also a lot of "Rust envy"[1] going around from some people (mostly disgruntled C++ devs who feel threatened by it) who'll baselesly say anything and misrepresent something to prove their point. How does it never cross their mind that they're on the wrong side of things if they have to grasp for lies to prove their points?

[1]: I came up with the term just now, but I'm not sure "envy" is the right word; maybe "petty spite" is a better term.


I'm back-and-forth on whether they're actually a troll. In the best case, they're a non-L1 English speaker who's upset but isn't making particularly coherent points. But things are coming to a close anyways.


I wasn't sure if it's a language issue at first myself (I'm still not completely sure), but based on their replies it seems like it's just a fruitless smear quest because they don't like something about Rust.


[flagged]


Nothing about what I said implies a value judgment about Go (or even Rust, for that matter). This is now the third time this comment tree has gone into accusations of strawmanning. Have you considered that nobody's trying to strawman you, but rather that people are struggling to find coherency in your points?


Rust was announced in 2010. Many sources state it is 11 years old.

The kernel is a crucible. I'm curious to see if it's system facilities are adequate and operate with reasonable costs in that context. We'll have to see, but I am still suspicious of what often comes across as hype.


Uh dude, might want to do a bit of research first. Rust is getting increasingly popular and is close to being an official language for wiring Linux kernel drivers. If that doesn’t count as having made it, I’m not sure what else will.


Literally provided a link with its popularity.


Why not a link to which languages programmers like the most[1]? It's our field, after all.

[1]: https://insights.stackoverflow.com/survey/2021#section-most-...


Mildly saddened at the “dreaded” percentage on Erlang.


At least you're beating Ruby! I guess programmers don't always have the best tastes, at least according to my Extremely Objective Opinions.


elixir is much nicer in my experience. anything you want to do in erland, you can do in elixiir + you get a lisp like macro system


you are misunderstanding what this data shows.


Am I missing something that isn't in the actual leader paragraph?

> For the sixth-year, Rust is the most loved language, while Python is the most wanted language for its fifth-year.


Really it baffles me that anyone bothers learning anything but SAP. ;)


In my experience Rust has become the go-to language for applied cryptography and is becoming increasingly popular for embedded/iot development. We're currently hiring for both and experience a scarcity of developers.


This had absolutely nothing to do with the article. Why did you decide to spend your time bashing something you don't use unprompted?


> There are a lot of ideological traps in this industry and many people that fall for them. Why people are interested in ideologies and cults is beyond me.

Most people who make remarks like that are not nearly as exceptional as they think they are. https://xkcd.com/610/

But just to give the actual answer, it’s probably that:

* Things are not okay. Read any CVE list if you wish to deny it.

* It’s not getting better. In fact, it’s getting worse, because software is getting more complex.

* Making software less complex is a fool’s errand. The whole point of software is that it can be more easily changed than hardware, so just not changing it at all is missing the point. Yet removing features that have been put out there is disruptive, and often selfish, egotistical, and demonstrating a poor organizational structure (I’m looking at you, Google, and your dozens of chat apps). As such, we can expect successful software to monotonically increase in complexity forever.

Do you have a response that isn’t either either: something that a cynic could dismiss as a cult, some sort of “your needs don’t matter” dismissal of features that a lot of people like, or a bleak declaration that the whole world sucks and that’s just the way it is?


I believe that derivatives of this language might be interesting. However we do have to point out what is wrong with it, so it can be fixed in the derivative.


Feel free to do that then, it might make for a more compelling and less troll-y comment thread.


Reality is that Linux is gradually moving toward making modules in Rust. So check your sources, they appear to have nothing to do with actual reality.


Meanwhile on AOSP they are already a reality.

https://source.android.com/setup/build/rust/building-rust-mo...


Python, currently sitting at #1 on the index, was 11 years old in 2002, for comparison.




Join us for AI Startup School this June 16-17 in San Francisco!

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: