this post was submitted on 27 Feb 2025
88 points (98.9% liked)

Programmer Humor

33658 readers
260 users here now

Post funny things about programming here! (Or just rant about your favourite programming language.)

Rules:

founded 5 years ago
MODERATORS
 
top 22 comments
sorted by: hot top controversial new old
[–] [email protected] 2 points 9 hours ago

Agents are gonna write the code anyway, so can do what it wants.

[–] [email protected] 8 points 1 day ago (1 children)

Personally I wouldn't abuse a language like that. If you want to write Python, write Python. Don't pretend some other language is Python, because it isn't. The braces need to be in the "correct" place, i.e. { at the end of a line or on a line on its own, and } on its own line, with both braces indented correctly for the code they contain. Braces are important visual and logical indicators in C-like languages and are critical in understanding the flow of the code.

That said, if this is some silly little noddy program that only you will ever see then you can write it however you want. Don't expect to be taken seriously as a competent dev though if this is going to be part of your public profile.

[–] [email protected] 2 points 4 hours ago

If this offends your sensibilities then I can't wait until you look at what someone did to C:

https://gist.github.com/shakna-israel/4fd31ee469274aa49f8f9793c3e71163#file-letsdestroyc-md

[–] [email protected] 6 points 1 day ago

Just write python inline in your Rust code https://crates.io/crates/inline-python

[–] [email protected] 11 points 1 day ago

The last line is peak

[–] [email protected] 20 points 1 day ago

I'm screaming internally and externally.

[–] [email protected] 16 points 1 day ago

Kill it with fire

[–] [email protected] 5 points 1 day ago (1 children)

For a moment I wondered why the Rust code was so much more readable than I remembered.

This would make a nice VS Codium plugin to deal with all the visual clutter. I actually like this.

[–] Tlaloc_Temporal 1 points 1 day ago (2 children)

I wish I could do this with every IDE. Get rid of all the semicolons and most curly braces and replace them with structural whitespace. You could even save the files with the punctuation and compile that to whitespace when editing.

[–] [email protected] 4 points 1 day ago* (last edited 1 day ago) (1 children)

You people are insane. Languages with meaningful whitespace are my personal hell. Don't you value being able to space/tab/newline as you please?

[–] Tlaloc_Temporal 1 points 1 day ago

I already do, it strengthens the structure of the code in my mind.

[–] PeriodicallyPedantic 3 points 1 day ago* (last edited 1 day ago)

For a long time we've said it's important to separate semantics and presentation (eg html vs css).

I've always wondered why we never followed our own advice when creating new programming languages. Let the IDE present whatever TF you want, and in the background it's simply building an Abstract Syntax Tree and serializing that to a file in whatever serialization format it prefers.

I've dreamed of making my own data-flow language that follows that principle, but I have neither the knowledge of compilers nor the free time to try.

[–] [email protected] 7 points 1 day ago

Looks neat, except for the rightmost column. Delete that and try again.

[–] [email protected] 1 points 1 day ago (1 children)

Why does even a modern language syntax insist on having end of line characters like semi colons. Surely we have moved beyond that. What is even the point of those characters?

[–] [email protected] 9 points 1 day ago

It's too hard to tell whether people in this thread are trolling.

[–] [email protected] 4 points 1 day ago (2 children)

On a serious note, how hard is rust if I know python?

[–] [email protected] 5 points 1 day ago* (last edited 1 day ago)

Depends on how fast you memorize and understand its 5 rules for ownership (3) and borrowing (2), and how much effort you put into memorizing its types.

The biggest hurdle I had with it is not reflexively understanding how the intermediate types it has work and how to bounce between them. For example: String -> &str -> String. Collection -> filtered/split slice of it -> back to Collection.. It's often not just 1 type either, it's multiple types which you get by functions declared in traits.. Just typing this is giving me a headache.

Combine unintuitive types/not knowing them all by heart with not fully understanding borrow/ownership rules, and you're going to have a bad time.

Long story short: it's a fantastic language, and I hope I never touch it ever again. I don't really need types or memory safety for what I do, but I appreciate it for what it is.

[–] [email protected] 12 points 1 day ago (1 children)

I don't like this type of question. In my experience knowing one language has little impact on learning another. What matters much more is understanding the underlying concepts.
If you grok OOP it doesn't matter if you go from Java to C# or from C++ to Python. Yes, there are differences, but they're mostly syntactic in nature.
So assuming you got the hang of imperative programming and maybe had some exposure to functional programming, too, the concept you're likely to struggle with the most is ownership. Simply because it's a concept that's fairly unique to Rust.
Having come from Java, via C++ and Python and having dabbled with Haskell a bit, I feel like The Book does a decent job of explaining Rust in general and its oddities in particular.

[–] [email protected] 5 points 1 day ago

Appreciated.

[–] [email protected] 1 points 1 day ago (1 children)

what are some good resources for learning rust by the way?

is documentation good/up to date?

[–] [email protected] 5 points 1 day ago (1 children)

Yeah the rust book is fantastic, you can learn directly from that.

I like learnxinyminutes.com for quick reference.

[–] [email protected] 1 points 9 hours ago

Then rustlings after