If we start talking about Rust in here I'm going to start having a lot of opinions about Rust so I'm going to resist the urge to do that. (I worked on it as a paid contributor for a brief internship.)I actually want to know the Rust opinions. I'm using it and working around the borrow checker is kind-of a bitch, especially when you need to work with explicit lifetimes, but I enjoy a lot about the language so far - pretty great support for metaprogramming, the lightweight and non-restrictive nature of traits, binary literals, operator overloading exists, and, as a bonus, I like the syntax.
Nifty Nif, July 22, 2016, 05:26:06 pm
Here's a personal thing: I'm sick of Java haters. Call me bias [sic], but it's an immensely powerful language that has given rise to some incredible design patterns, and if you don't like reflection you can fuck right off. I like reflection a lot. Sure, it's dangerous in the wrong hands, but I can unit test literally any codebase I want with the right libraries. Haters gonna hate, I'll just be over here with my 100% test coverage and then we'll see who thinks what of Java.I agree with you a lot, actually. Java is a pretty good language - especially modern Java, with annotations and typechecked generics.
Nifty Nif, July 22, 2016, 05:26:06 pm
Gyro, July 22, 2016, 08:18:59 pm
Annotations and typechecked generics are the bomb! I think part of my affinity for Java comes from the fact that I have little experience with pre-Java 7 versions. I love using Java 8 and I enjoy its support for functional paradigms. It's becoming a more expansive language. Generics are extremely useful also, and I know some critics think that they're overly powerful or not in step with Java's philosophy. I disagree, as they're pretty fundamental to OO, IMHO. I agree with @Zekka that you could implicitly make things private, though, that'd be nice. Package-private is a bullshit designation that people don't really use that often.
Okay, Rust stuff. I worked on Rust for a little while, and the feeling that I got while poring over loads of documentation and wrestling with the compiler for hours and hours was that the core design team had written a language with some incredibly robust features but didn't give a single fuck if it was unusable to everyone.
Sure, the documentation is arguably lengthy. And yeah, maybe someone will give you the advice not to program in Rust if you don't understand the ins and outs of execution state, reference passing, etc. As a developer who is fortunate enough to know a bit about a few impractical things, I think this is bullshit. The situation as it stands is that Rust is a language with an insurmountably steep learning curve. It only has real utility for kernel hackers, and it really does have great use for them (userspace concurrency, memory management with unsafe keywords, etc). However, Mozilla is trying to pitch Rust as a C-killer, and Rust is too hard to use for that to ever be possible at this point in time. They're trying to shoehorn Rust into Servo, their browser engine. There was another engineer working on Servo at the same time as I was working on Rust, and I think she was using Rust to accomplish her task. She had a lot of the same problems I did, as far as I could tell--the compiler doesn't cooperate as soon as you decide to pass a variable to another function, so you've got to decide whether to pass by value or reference, and god help you if you choose the wrong one. The way around this is to use Rust's paradigms, but these are obscure and highly functional in nature and often inaccessible to the average developer.
I did manage to write a gorgeous B-tree library (the task for my internship), but sadly, my laptop crashed on the last day of my internship and all of my work was lost right before I could commit, so all that's in the repo is the piss-poor OO one I tried to write, which never worked. The only reason I was able to write a working implementation at all was because I was invited out to meet the core team at their research summit, and I had one of the head engineers write it with me. Once it finally clicked, it was like magic. I couldn't replicate it now--this was almost 3 years ago, and like I said, the work has been scattered to bits. Good thing the feature I wrote was non-essential and will never exist anywhere for anyone. Someone else has probably written it by now, or tried and failed again.
So the way to write Rust is to pretend you're writing Scala or Haskell or something, never an OO language, and just be as minimal as possible. Once the borrow-checker starts arguing with you, throw your computer out the window or just write some nice Python instead. Or maybe do something nice for yourself, like play video games or hang out with your friends. Anything but program in Rust. It's not a C-killer and it's not revolutionary. It's just syntactic salt and syntactic sugar in the same jar.