9 comments

[ 3.2 ms ] story [ 33.5 ms ] thread
(comment deleted)
"Is better" always needs to be followed by "...at X". I'd contend that COBOL is better than Java ...at running on an old AS/400. Doesn't mean I'd touch otherwise touch it with a 10 foot pole, though.

> Even when I do systems programming, like low level stuff, I just want to manage my own memory. I do not want to beg the compiler to let me write code, I just want to allocate stuff and put stuff into there. C is fine for this. I’ll try zig later.

Oh lordy please no. That's how we got into so many messes in the first place. I think writing Rust made me a better C programmer by drawing my attention to how many bad things I was doing that a C compiler would cheerfully compile without saying a word. Oh, you want to malloc a chunk of heap, free it 8 calls deep in some random function, and then pinky swear never to touch it again? Go for it!

I don't have anything objectively bad to say about Java, except that it's probably a terrible fit in any scenario where you'd be using Rust in the first place. (Notice there's not a big push to re-implement a bunch of command line tools in Java?) For me, it's almost entirely a preference thing. Java looks ugly and inelegant to me in a way almost no other popular language does. It doesn't mean you can't write beautiful, elegant code in Java. It does mean, in my opinion, that it will never look beautiful and elegant. By analogy, notice that even people who've taught themselves Klingon don't spend a lot of time writing poetry in it. You could, but it's never going to sound as pretty as a shopping list written in Italian.

> Oh, you want to malloc a chunk of heap, free it 8 calls deep in some random function, and then pinky swear never to touch it again?

There is no default system memory allocator in Zig--this is a signficant difference between Zig and C or Rust.

If you want to allocate in Zig, you have to cough up an allocator and pass it around.

The downside is that a lot of things need an allocator and that makes some things more complicated (printing to console, for example). The upside is that if there is no allocator being passed, you're guaranteed to not be allocating/deallocating memory.

I think Rust gets overhyped outside of its original intended area, systems programming. They see things like "zero cost abstraction" and think its great for everything. Turns out, the cost is paid by the developer. Application languages like Java are great for what is likely the vast majority of programs. And with a bit of work, it can also be used in performance sensitive areas.

Also can someone tell me exactly what they mean by "Java is ugly?" Yes, you can write ugly Java, but you can write ugly code in any language. You can also write elegant Java, it just takes more skill. I don't see verbosity as a negative, since any half decent IDE has had non-AI autocompletion for decades, and your screen has been able to accommodate more than 80 characters for even longer.

I work for a tiny software company that probably wouldn't still exist without Java. It always seems like it's the second-best language for just about every use case, and that makes it incredibly flexible for a small team. That said, I don't really find the language itself "elegant" but who cares - it works (also I'm not a developer). I think "enterprise" development patterns that try to standardize Java development created a lot of the "Java is ugly" attitudes as well.
> I don't see verbosity as a negative, since any half decent IDE has had non-AI autocompletion for decades

I've thought the same thing for a really long time. Are people writing code with notepad??

No but if I’m on limited screen size, such as a laptop, I rather not have code wrap a line because “public” instead of “pub”
I am still what I would classify as “learning rust” and have yet to do anything very complicated with rust (have been doing large-scale C/C++ professionally for nearly 20 years).

Conceptually, the borrow checker and lifetimes are no big deal. (As an aside, I think that the less exposure someone has to other programming languages, the easier it is to “get it”) They are being introduced and taught very poorly. By very smart and accomplished experts, yes. Just not experts in teaching. And if you look at the GitHub discussions for the rust book, for example, you’ll see suggestion after suggestion on how to make improvements - from people learning rust - but they don’t want to accept this advice because then the website and the printed book would diverge.