Hacker News new | ask | show | jobs
by fluoridation 967 days ago
I don't really agree with that. I'd say they're complex in different directions. C++ has complexities Rust doesn't because it bends over backwards for source-level compatibility. A lot of it is entirely at the semantic and pragmatic level. Rust's complexities are mostly due to its type system, meaning the complexity is at the syntactic level. I had never seen a computer crash because an IDE was trying to figure out how to parse a program before I worked with Rust, for example.
4 comments

It is funny that you mention so specific a situation, as a very funny version of this was going around yesterday: https://developercommunity.visualstudio.com/t/Too-much-anime...

It doesn’t invalidate your experience, it’s just a funny bug.

"Too much anime" was not a phrase I expected to see in a compiler bug report.

Internal compiler errors do happen from time to time. They're annoying but usually easy to work around. I've had projects where I just cannot use rust-analyze because it just never finishes. It just eats RAM without accomplishing anything.

>"Too much anime" was not a phrase I expected to see in a compiler bug report.

Looking on the code example they provided [1], the comments is literally an anime character. Is he Naruto?

[1] https://godbolt.org/z/1PGrYjq3h

That looks more like Goku or another Dragon Ball Z character. It's a pretty funny bug report for that fact though.

    namespace StreetFighter { 
    class Ryu
Just a hunch, but I think that might be Scorpion from Mortal Kombat.
Blockchain? Did you file an issue?
Hah. Yeah. No, I didn't file an issue. I don't think it's a bug on rust-analyzer. There's only so much a language server can do.
>I had never seen a computer crash because an IDE was trying to figure out how to parse a program before

This happens daily on my Intel MBP in Xcode. In only a ~15k LoC small app, 99% Swift. I’ve had to break up several functions into smaller ones purely because the compiler chokes so easily. They actually have a dedicated error message to the tune of “couldn’t figure out types here, could you break this function up please?”.

But yeah, outside of that I’ve never seen it happen in major languages using major language tooling. Never even saw it in 5 million+ line C/C++/.NET CLR mixed codebases.

> I had never seen a computer crash because an IDE was trying to figure out how to parse a program before I worked with Rust, for example.

C++ is complex enough that the IDE can't really parse much of the program's code in any useful fashion. You're lucky if it can get the right type hints and jump to definition. And even the latter may not be complete.

Contrast with e.g. Java, which makes it easy for the IDEs to get the full picture.

Sure, but in those cases the parser just gives up. It doesn't grow its working set trying harder and harder seemingly forever.

We're talking about C++ and Rust here, so I don't know why you bring up Java. If parsing Rust was as easy as parsing Java you would not see me complaining about it.

Giving up vs. crashing is a trivial difference, ultimately boiling down to an extra terminating condition connected to real-world resource use. Either way, the parsing is useless.

I brought up Java as an example of what it means for the IDE parsing to work and be useful.

Losing your work versus a minor inconvenience is a trivial difference to you? Well, okay!
What kind of IDE are you working in that will lose your work when it crashes?

I don't know what's going on in the Rust world, but in C++ world, even the good ol' Visual C++ (2017, 2019), when it crashes (which it does surprisingly often on my work's codebase), it doesn't lose anything other than maybe unsaved edits. It's annoying, sure, but 30 seconds later it's back to where it was before the crash.

Also, a not working parser is not a trivial inconvenience. It just means the tool doesn't work. From the POV of wanting to use advanced functionality that relies on parsing the code, it doesn't matter whether the tool aborts its execution so it doesn't crash, or has to be disabled because it doesn't abort its execution and just crashes. The end result is the same: I can't use the advanced functionality.

What I said was that the computer crashed. The IDE used so much memory that it took the system with it. When it came back up something weird had happened to the environment and it was ignoring the stuff in .bashrc.

>Also, a not working parser is not a trivial inconvenience. [...] The end result is the same: I can't use the advanced functionality.

Yeah. Now compare "the IDE is just working as a glorified text editor" to what I'm describing above.

I had emacs crash (well, lock-up) while trying to parse the error messages from some extreme C++ metaprogramming. It was at least a decade ago and both emacs and C++ have improved, but still...

edit: mind, in the same code base (10M+ loc), Visual Studio would crash while attempting to initialize Intellisense.